@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