I've seen those examples through the documentation but I couldn't get any help from them. Sorry...
I've tried a lot of options, one of the last:
Data function
function myDataFunction(from, to, step, callback) {
MyServices.getSomething(obj).success(function (data) {
myData = data.value;
console.log(JSON.parse(myData));
});
callback({
dataLimitFrom: from, // dataLimitFrom: myData.dataLimitFrom,
dataLimitTo: to, // dataLimitTo: myData.dataLimitTo,
values: myData.values,
from: myData.dataLimitFrom,
to: myData.dataLimitTo,
unit: step
});
}
Chart Settings
dataFunction: function (from, to, step, success, fail) {
// as a sample let's use a javascript function, normally server request would go here.
myDataFunction(from, to, step, success);
},
Angular service
angular.module('myApp')
.service('MyServices', ['$http', 'ConstantsService', function ($http, ConstantsService) {
this.getSomething = function (obj) {
return $http.post(ConstantsService.MY_SERVICE_URL , { "filtro": obj });
}
}]);
The error
As you can see, the attributes inside myData are not defined. But if I log them, they are just as I expect them to be.