Home Forums Chart Support How to handle NaN data points

How to handle NaN data points

Viewing 2 posts - 1 through 2 (of 2 total)
  • #43494

    How to handle NaN data points

    {x: -79.84303056719757, y: NaN}
    {x: -79.68303056719758, y: NaN}
    {x: -79.52303056719757, y: NaN}
    {x: -79.36303056719757, y: NaN}
    {x: -79.20303056719757, y: NaN}
    {x: -79.04303056719758, y: NaN}
    {x: -78.88303056719757, y: NaN}
    {x: -78.72303056719757, y: 0.18}
    {x: -78.56303056719757, y: 0.208}
    9
    :
    {x: -78.40303056719756, y: 0.052}
    10
    :
    {x: -78.24303056719756, y: -0.164}
    11
    :
    {x: -78.08303056719758, y: -0.204}
    12
    :
    {x: -77.92303056719757, y: -0.052}
    13
    :
    {x: -77.76303056719757, y: 0.14400001}
    14
    :
    {x: -77.60303056719758, y: 0.224}
    15
    :
    {x: -77.44303056719758, y: 0.096}
    16
    :
    {x: -77.28303056719757, y: -0.128}
    17
    :
    {x: -77.12303056719757, y: -0.208}
    18
    :
    {x: -76.96303056719758, y: -0.112}
    19
    :
    {x: -76.80303056719757, y: 0.104}
    20
    :
    {x: -76.64303056719757, y: 0.228}
    21
    :
    {x: -76.48303056719757, y: 0.148}

    #43500

    @mnair,

    y value in datapoint object only accepts numeric value as of now. We suggest you to replace NaN value with null or 0 as shown in the code snippet below:

    
    for(var i = 0; i < chart.options.data[0].dataPoints.length; i++){
      if(isNaN(chart.options.data[0].dataPoints[i].y)){
        chart.options.data[0].dataPoints[i].y = null;
      }
    }

    __
    Sachin Bisht
    Team CanvasJS

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

You must be logged in to reply to this topic.