Im trying to visualise some data with angular-charts but I don't know what am I doing wrong. I'm a beginner in angularjs.
Data should be passed this way:
$scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
$scope.series = ['Series A', 'Series B'];
$scope.data = [
[65, 59, 80, 81, 56, 55, 40],
[28, 48, 40, 19, 86, 27, 90]
];
I am using $http to get it from API so I have sth like this:
app.controller("LineCtrl", function($scope, $http) {
$http({
method: 'GET',
url: '/meteo_dane'
}).then(function successCallback(response) {
$scope.dane = response.data;
$scope.labels = [$scope.dane.updated_at];
$scope.series = ['Series A'];
$scope.data = [
[$scope.dane.temp],
];
console.log(this.dane);
}, function errorCallback(response) {
//
});
But its now working - chart is empty. Data that I am going to use is in this format:
[
{
"_id": "567aa394d452128c6d595f0e",
"windspeedmph": 0,
"winddir": 135,
"humidity": 30.5,
"temp": 24,
"updated_at": "2015-12-23T13:37:24.881Z",
"__v": 0
},
{
"_id": "567aa39ed452128c6d595f0f",
"windspeedmph": 0,
"winddir": 135,
"humidity": 30.4,
"temp": 24.1,
"updated_at": "2015-12-23T13:37:34.836Z",
"__v": 0
},
]
I am going to show temperature in time. Later I would like to show the rest of data that I have.
How should I write it?