Is there a way to display negative numbers in chartist.js
? It seems that the library does not support negative numbers. Here is my code:
var _4date = 'D';
var _3date = 'C';
var _2date = 'B';
var _1date = 'A';
var _4all_scores = '-100';
var _3all_scores = '476';
var _2all_scores = '649';
var _1all_scores = '0';
var _4comments_scores = '-100';
var _3comments_scores = '20';
var _2comments_scores = '0';
var _1comments_scores = '0';
var _4transactions_scores = '0';
var _3transactions_scores = '456';
var _2transactions_scores = '649';
var _1transactions_scores = '0';
var chart = new Chartist.Line('.ct-chart', {
labels: [_1date, _2date, _3date, _4date],
series: [
[_1all_scores, _2all_scores, _3all_scores, _4all_scores],
[_1comments_scores, _2comments_scores, _3comments_scores, _4comments_scores],
[_1transactions_scores, _2transactions_scores, _3transactions_scores, _4transactions_scores]
]
}, {
low: 0,
showArea: true,
showPoint: false,
fullWidth: true
});
chart.on('draw', function(data) {
if(data.type === 'line' || data.type === 'area') {
data.element.animate({
d: {
begin: 2000 * data.index,
dur: 2000,
from: data.path.clone().scale(1, 0).translate(0, data.chartRect.height()).stringify(),
to: data.path.clone().stringify(),
easing: Chartist.Svg.Easing.easeOutQuint
}
});
}
});