Home forums Using CanvasJS canvasjs.min.js:209 Uncaught TypeError: Cannot read property 'getTime' of undefi

This topic contains 2 replies, has 2 voices, and was last updated by  Vishwas R 2 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24774

    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/

    #24775

    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

    #24785

    @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}
    ]

    Valid Format:

    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

    This is working fine as the format of dataPoints being generated is proper.


    Vishwas R
    Team CanvasJS

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.