shutterstock / rickshaw

JavaScript toolkit for creating interactive real-time graphs
https://shutterstock.github.io/rickshaw
MIT License
6.53k stars 939 forks source link

Compare year to year #442

Open lopesrb opened 10 years ago

lopesrb commented 10 years ago

Is there any way to make a year to year comparison in order to compare data from two different years in the same chart?

bryanbischof commented 10 years ago

Differently that using this example: http://code.shutterstock.com/rickshaw/examples/lines.html

with each series given by a year?

lopesrb commented 10 years ago

The objective is to compare data from two different years.

In one line there would be data from 2012 and in the other line data related to 2013. And the legend would vary accordingly.

bryanbischof commented 10 years ago

Yes, simply change the data array in the above example so that your data is there instead of the random data, i.e. yourData[0] is the 2012 data and yourData[1] is the 2013 data. Then:

series: [ { color: "#c05020", data: yourData[0], name: '2012' }, { color: "#30c020", data: yourData[1], name: '2013' } ]

Will produce this graph for your two years.

lopesrb commented 10 years ago

Thanks!