Home Forums Chart Support missing zero data points

missing zero data points

Viewing 3 posts - 1 through 3 (of 3 total)
  • #32051

    I have a stacked barchart generated from data where I did not know all the row data and some values do not exist.
    I guess I will have to go through the data a second time once all the values are known and add zero values for missing data.

    I am wondering why the software has bad results otherwise?

    I made a copy of a stackedchart here : https://jsfiddle.net/pworthing/xmg178qt/1/
    This is simply a copy of an existing demo : https://jsfiddle.net/user/canvasjs/fiddles/ where I have removed two data points, rather than change them to zero.
    The result does not work in this case, ie: pinenuts is empty

    In this other simple example, I have duplicate labels where “admin” is missing and “other” is listed twice:
    https://jsfiddle.net/pworthing/m3krjcyf/5/

    A second minor question with the onclick function in the second example. how can I get the value of the inner dataset name value that is clicked. And ultimately the same value that is moused over for the tooltip. I wanted to put a flag next to the data where the mouse is.

    #32077

    @pworthing,

    The result does not work in this case, ie: pinenuts is empty

    Tooltip is showing just name incase of datapoint with label pinenuts because of if(e.entries[i].dataPoint.y) condition. Checking if the y-value is greater-than or zero should work fine in this case. Please take a look at this updated JSFiddle.

    In this other simple example, I have duplicate labels where “admin” is missing and “other” is listed twice:
    https://jsfiddle.net/pworthing/m3krjcyf/5/

    A second minor question with the onclick function in the second example. how can I get the value of the inner dataset name value that is clicked. And ultimately the same value that is moused over for the tooltip. I wanted to put a flag next to the data where the mouse is.

    You can get the dataSeries name on clicking on a particular dataPoint as e.dataSeries.name. Also updating name property on clicking datapoint should work fine in this case. Please take a look at this updated JSFiddle.

    PS: Stacked Bar Charts are plotted when multiple Bar Charts with aligned x values are plotted on same axis. But in the JSFiddles that you have shared, x-values are not used but only labels.


    Vishwas R
    Team CanvasJS

    #32122

    thanks for your help. Adding x value to stack chart helps. I did not think that was necessary.
    Faster than my alternative which was to trace through each noting what values were missing and adding empty zero option

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

You must be logged in to reply to this topic.