Home forums Using CanvasJS Data stops updating (for apparently no reason)

This topic contains 2 replies, has 2 voices, and was last updated by  eu.mesma 8 months ago.

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

    eu.mesma
    Member

    Hi, I’m using the area chart, and I’m having problem with updating the chart.

    The data that feeds the chart can be changed by the user, so the chart should update according to user’s input. It all works fine until one specific function “clearThis()” is called. This function replaces the points inside the array holding the data (called ‘load1’) by [{x:0, y:0}], erasing the previous data. After that, it seems like the chart loses its capacity to read the data array (load1), and the chart stops updating. I don’t see why, and I can’t find the error.

    My code in under this folder
    https://www.dropbox.com/sh/v4h1kbuc7mf2bze/AAAt3lahanImAUzHSobuhaeva?dl=0

    I appreciate any help!
    Thanks

    #19732

    Vishwas R
    Keymaster

    @eu-mesma,

    Within clearThis(), you are trying to assign dataPoints to dataSeries. Updating it properly should work fine in this case i.e. Replacing chart1.data = load1; with chart1.options.data[0].dataPoints = load1; should work fine. Here is the working code of the same.


    Vishwas R
    Team CanvasJS

    #19741

    eu.mesma
    Member

    I missed that! thank you very much!! you guys are the best <3

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

You must be logged in to reply to this topic.