Reputation: 427
I'm using Chartist to create charts. i have day labels:
1,2,3,4,5 and so on
I have a serie like this:
1131586,1132542,1133480,1134294,1135146,1136253,1137259,1139946 and so on
No i add a new line with different series of value. The new line show the difference between a point and another like this:
0,956,938,814,852,1107,1006,2687,1859,879,900,765 and so on
The chart show two horizantal lines! How can i show the lines correctly?
Upvotes: 1
Views: 1871
Reputation: 3945
In general if you have 2 data series and a label you would do something like this:
new Chartist.Line('#chart4', {
labels: [1,2,3,4,5],
series: [[1131586,1132542,1133480,1134294,1135146,1136253,1137259,1139946],[0,956,938,814,852,1107,1006,2687]]
});
With the following result (Top Chart):
http://codepen.io/k3no/pen/ozrgNq
Chartist is working correctly, it is your data that needs to be different, or in other words, it needs to be normalized so it can be displayed in the same chart.
You have a few options:
Display 2 charts one on top of the other (middle 2 charts), notice at this point you can already draw your conclusions and the data has not been tampered with, so this is my preferred method whenever possible and data permitting.
Normalize one data series to the other, or both (it's a bit of a complex issue and outside of scope, but here's an introduction):normalization
Preprocess your data so you display a single line.
Upvotes: 1