Home Forums Chart Support Plotting data with null value

Plotting data with null value

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

    Hi Team,

    I have a case where I need to draw the line till null and break the line after that point.

    For example I have 4 data points [{x:’Apr 23′,y:10},{x:’May 23′,y:null},{x:’Jun 23′,y:30},{x:’Jul 23′,y:40}]

    Existing behaviour: Apr 23 plots a dot, then gap till Jun 23 and draws a line from June 23 to July 23

    Expected behaviour: A line should be drawn from Apr 23 to May 23, then gap till Jun 23 and draw a line from Jun 23 to Jul 23

    #42968

    @vinay4422,

    The current behaviour of the null datapoint is as per design. However, to achieve your requirement, you can set the y-value of “May 23” to the same y-value as the previous datapoint and add a dummy datapoint with y-value as null in between the “May 23” and “June 23” data points. Kindly refer to this JSFiddle for an example on the same.


    Adithya Menon
    Team CanvasJS

    #42976

    Hi Adithya,

    Thanks for the quick response. But it’s creating an issue with addmissingDatapoints and getPreviousDp functions.
    These methods were suggested by one of your team member for tool tip customisation

    Js Fiddle Example

    #43076

    @vinay4422,

    To achieve your requirement, you can pass the toolTipContent property of the dummy data point as null.

    Kindly refer to this JSFiddle for an example on the same.

    If the solution suggested doesn’t fulfill your requirement, kindly brief us further about your use case so that we can understand your scenario better and help you out with an appropriate solution.


    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.