jeudi 23 juin 2016

Add together all data for each date

Ember 2.5

I have a model called journey with many journeys as JSON data. Most of the journeys have the same date as another journey other.

// journey JSON example
{
    id: 1,
    date: "2016-02-01",
    emissions: 2,
},
{
    id: 2,
    date: "2016-02-01",
    emissions: 3,
},

I want to display this data on a line graph with date on the x axes and the total emissions for that data on the y.

How can I gather this information so that there is one of each date with the total emissions. This array will need to be created as the route the chart is display in in loaded as the data will change a lot.

Also, using ember-cli-chart, how can I display this data on a graph?




Aucun commentaire:

Enregistrer un commentaire