In xaxis i need to display the date time, as i am passing the epoch value, but it is displaying the old date of 1970.
but if i am converting the epoch value to date time then it shows the exact value.
>>> time.strftime(‘%Y-%m-%d %H:%M:%S’, time.localtime(1558743070))
‘2019-05-25 05:41:10’
Where i am going wrong. Please help me.
Below is my code:
————————-
window.onload = function () {
var chart = new CanvasJS.Chart(“chartContainer”,
{
axisY:{
valueFormatString:”$#######.00″
},
axisX:{
xValueType: “dateTime”,
valueFormatString: “DD/MM/YYYY HH:mm”
},
data: [
{
type: “spline”,
xValueType: “dateTime”,
xValueFormatString:”DD/MM/YYYY HH:mm”,
yValueFormatString:”$#######.00″,
dataPoints: [
{‘x’:1558743070,’y’:566},{‘x’:1558743130,’y’:563},{‘x’:1558743190,’y’:565},{‘x’:1558743250,’y’:564},{‘x’:1558743310,’y’:566},{‘x’:1558743370,’y’:569},{‘x’:1558743430,’y’:570},{‘x’:1558743490,’y’:565},{‘x’:1558743550,’y’:566},{‘x’:1558743610,’y’:565},{‘x’:1558743670,’y’:568},{‘x’:1558743730,’y’:569},{‘x’:1558743790,’y’:565},{‘x’:1558743850,’y’:567},{‘x’:1558743910,’y’:570},{‘x’:1558743970,’y’:571},{‘x’:1558744030,’y’:568},{‘x’:1558744090,’y’:569}
]
}
]
});
chart.render();
}