Hi again.
I am using the tabbed example and want to add chartjs.
I am not sure where to put what.
My html template for the friends detail has this:
< canvaselement id=“myChart” width=“400” height=“400”>< /canvaselement >
(correctly written but otherwise you can’t see the markup here )
but where do i put and link the items from “data” to the canvas element? So it gets the correct data from the friend id sub item. I am not sure where to write and transform it:
.controller(‘FriendDetailCtrl’, function($scope, $stateParams, Friends) {
var ctx = document.getElementById(“myChart”).getContext(“2d”);
var myRadarChart = new Chart(ctx).Radar(data, options);
$scope.friend = Friends.get($stateParams.friendId);
})
(this currently resides in the controller.js where the frienddetailpage is loaded)
In other words how do i pass on the data from my friends array that has a subitem data so the chartjs gets displayed correctly.
My json array looks like this: and i think the data part messes things up (as i don’t see the data that was given in, but not sure how to rewrite it. The moment i cut out the data item from the json my app works again.
var friends: [{
… More items here …
Glass:’’,
Rating:5,
data:
[
{
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 96, 27, 100]
}
],
}
],
Extras:
[
{
label: 'Car',
value: 'No'
},
{
...more items here
Once i know this i assume this will work the same as with google maps data.
I know this might be a grand question but any help is appreciated.
I found some examples online which all works great. But none passes the data from an allready existing json array.
Thanks!