Home Forums Chart Support array

array

Viewing 4 posts - 1 through 4 (of 4 total)
  • #36071

    Hi, im working on my school project and i need values from array get as dataPoitns, i try a lot, but nothing was working. I need to link date to.
    Thank you, Domnik

    #36073

    Domnik,

    The dataPoints must be parsed in a format accepted by CanvasJS. You can parse the dataPoints from an array and render the chart as shown in the code-snippet below,

    function parseDataPoints () {
      for (var i = 0; i <= dataArray.length; i++)
        dps.push({y: dataArray[i]});     
    }
    
    parseDataPoints();
    chart.options.data[0].dataPoints = dps;
    chart.render(); 

    Kindly take a look at this JSFiddle for an example on parsing dataPoints from array and rendering the chart.


    Adithya Menon
    Team CanvasJS

    #36329

    Hi, i try it, but it is not working. I dont know what to do next. this is my code https://jsfiddle.net/Dominikbalun/nvpezc2y/3/
    Dominik

    #36342

    Dominik,

    The minimum and maximum properties are used to set the range of the X-Axis. In the code shared by you, there are no datapoints present within the axis range that you are setting. Removing the same should work fine in this case.

    Kindly take a look at this updated JSFiddle for working code.


    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.