I am working on creating a graph depending on the date with two series:
- number of items created
- updated number of items
I made a request from our API and received a file that has the following data:
"result":[
{
"closed_on" : "YYYY-MM-DD",
"created_on" : "YYYY-MM-DD"
}
{
"closed_on" : "YYYY-MM-DD",
"created_on" : "YYYY-MM-DD"
}
{
"closed_on" : "YYYY-MM-DD",
"created_on" : "YYYY-MM-DD"
}
{...}
]
I was wondering what is the best solution for getting data for a graph as a collection of objects of this type:
x : date,
created : integer,
updated : integer
I thought that you need to have a table with a date as an index and iterate over the whole file and increase the value in the indexed table.
However, I had some problems finding information on the Internet. I thought of something like this:
$scope.datas=[];
$scope.date = $scope.date.start;
while($scope.date!==$scope.date.end)
{
$scope.datas.push({
date
: [{
closed_tickets:0,
created_tickets:0
}]
});
$scope.date = $scope.date.addDays(1);
}
However, this does not work. Any suggestion? Thanks!
source
share