chartist
chartist copied to clipboard
I'm not able to display time-series chart using chartist nor am i getting any error to understand the problem
` const co = require('co');
const Chartist = require('node-chartist')
const generate = require('node-chartist');
app.get('/',function (req,res) {
var data = [{"transDate":new Date(1393995600000),"inStockCount":95},
{"transDate":new Date(1396152000000),"inStockCount":62},
{"transDate":new Date(1398225600000),"inStockCount":51},
{"transDate":new Date(1400644800000),"inStockCount":35}
];
co(function * () {
const options = {
width: 800,
height: 800,
axisX: {
type: Chartist.AutoScaleAxis,
showGrid: false,
scaleMinSpace: 60,
labelInterpolationFnc: function(value, index) {
return (new Date(value)).toLocaleDateString();
}
},
axisY: {
showGrid: false,
offset: 0,
labelInterpolationFnc: function(value, index) {
return null;
}
}
};
const line = yield generate('line', options, {
series:[
data.map(function(s) {
return {x: s.transDate, y: s.inStockCount, meta: s.inStockCount + ' on ' + s.transDate.toDateString()};
})
]
});
res.render('index',{chart:line})
})
})`
What is the issue in this code?
Hello @adeete 👋
Chartist has recently been updated to version 1.0
with some new exciting changes like ESM and TypeScript support. The migration guide can be found right here.
Please let me know if the issue is still relevant to you so we can further investigate it!