Reputation: 1437
Is there a way to make the x axis on a chartist line graph to not start at 0 but 10 under the min and 10 above max value, currently no matter what the minimum number it always starts at 0?
Upvotes: 1
Views: 2111
Reputation: 3364
Normally Chartist.js already does what you want. However, with options high
and low
you should be able to setup the borders of the diagram yourself, though this requires you to calculate those values for yourself:
var chart = new Chartist.Line('#chart',
{
"labels": ["11/July", "12/July", "12/July", "13/July", "13/July"],
"series": [[ 2150, 2152, 2147, 2148, 2149 ]],
}, {
high: 2160,
low: 2140
}
);
See also JSFiddle
Upvotes: 3