When the count of points is less than 12, then I got below error info:
canvasjs.min.js:546 Uncaught TypeError: Cannot read property ‘x’ of undefined
at F.getDataPointAtX (canvasjs.min.js:546)
at $._updateToolTip (canvasjs.min.js:818)
at $.mouseMoveHandler (canvasjs.min.js:816)
at p._plotAreaMouseMove (canvasjs.min.js:263)
at p._mouseEventHandler (canvasjs.min.js:253)
at HTMLCanvasElement.<anonymous> (canvasjs.min.js:123)
F.getDataPointAtX @ canvasjs.min.js:546
$._updateToolTip @ canvasjs.min.js:818
$.mouseMoveHandler @ canvasjs.min.js:816
p._plotAreaMouseMove @ canvasjs.min.js:263
p._mouseEventHandler @ canvasjs.min.js:253
(anonymous) @ canvasjs.min.js:123
Here is my code:
function PlotChart(cd){
if(document.getElementById(cd.name) == null){
var v = document.createElement(“div”);
v.setAttribute(“id”,cd.name);
v.setAttribute(“style”,”height: 240px; width: 100%;”);
document.body.appendChild(v);
document.body.appendChild(document.createElement(“br”));
}
var chart = new CanvasJS.Chart(cd.name, {
animationEnabled: true,
zoomEnabled: true,
theme: “light2”,
title:{
text: cd.name
},
axisX:{
includeZero: false,
valueFormatString: “HH:mm:ss.fff”
},
axisY:{
includeZero: false,
},
data: [{
toolTipContent: “{y}”,
type: “line”,
dataPoints: cd.dataPoints,
}],
rangeChanged: syncHandler
});
chart.render();
//chart.destroy();
//chart = null;
//charts.push(chart);
}