You must be logged in to post your query.
Home › Forums › Chart Support › canvasjs.min.js:209 Uncaught TypeError: Cannot read property 'getTime' of undefi
Hello everyone, I have a problem with the creation of my line chart. I use a lot of data to create the graph, about 30,000 points, the problem is that if I have few points in the array (example 5,000) this is displayed correctly, but when I have many more it sends this error:
canvasjs.min.js: 209 Uncaught TypeError: Cannot read property ‘getTime’ of undefined at p._processMultiseriesPlotUnit (canvasjs.min.js: 209) at p._processData (canvasjs.min.js: 206) at p.setLayout (canvasjs.min.js: 189) at p.render (canvasjs.min.js: 201) at window.onload (chance_mp.php: 80)
link js: https://jsfiddle.net/4qr9sL6o/
other peculiarity, if I use the php function in example to create random data the graph is displayed.
<? Php $ limit = 50000; $ y = 100; $ dataPoints = array (); for ($ i = 0; $ i <$ limit; $ i ++) { $ y + = rand (0, 10) – 5; array_push ($ dataPoints, array (“x” => $ i, “y” => $ y)); } ?>
if I use mine it only works with a few points
@reset,
I use a lot of data to create the graph, about 30,000 points, the problem is that if I have few points in the array (example 5,000) this is displayed correctly, but when I have many more it sends this error:
The issue is happening due to the incorrect format of dataPoints being passed to the chart-options. Removing redundant numbers between the objects of dataPoints array should work fine in this case. Please take a look at this Updated JSFiddle.
Format of dataPoints that you have passed: dataPoints: [{"y": 24},{"y": 24},34,{"y": -315}]
dataPoints: [{"y": 24},{"y": 24},34,{"y": -315}]
Valid Format: dataPoints: [{"y": 24},{"y": 24},{"y": 34},{"y": -315}]
dataPoints: [{"y": 24},{"y": 24},{"y": 34},{"y": -315}]
other peculiarity, if I use the php function in example to create random data the graph is displayed. Php $ limit = 50000; $ y = 100; $ dataPoints = array (); for ($ i = 0; $ i <$ limit; $ i ++) { $ y + = rand (0, 10) – 5; array_push ($ dataPoints, array (“x” => $ i, “y” => $ y)); } ?> if I use mine it only works with a few points
Php $ limit = 50000; $ y = 100; $ dataPoints = array (); for ($ i = 0; $ i <$ limit; $ i ++) { $ y + = rand (0, 10) – 5; array_push ($ dataPoints, array (“x” => $ i, “y” => $ y)); } ?>
This is working fine as the format of dataPoints being generated is proper.
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register