New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing/Hiding Based on Visibility of Lines in Chart #51
Comments
I think that's a bug, it should work out of the box. Can you build a jsfiddle that reproduces this issue? |
Here is a jsfiddle: https://jsfiddle.net/sxzqwr80/76/ |
That's a bug, will be fixed in next release (labels will always be hidden if the dataset is hidden). As a workaround, you can use: display: function (context) {
return context.chart.isDatasetVisible(context.datasetIndex);
}
|
It's nice!, thanks. |
Sweet 👍 |
Thanks 😍 |
Thanks. And I use this for display data with condition display: function(context) {
return context.chart.isDatasetVisible(context.datasetIndex)
&& context.dataset.data[context.dataIndex] > 0;
}
|
My code is TypeScript, so you may have to remove the non-JS stuff to get it to work. |
|
@wjohnsto Thanks (I updated my comment) |
Fixed in 542ec92, will be released in 0.4.0 |
I have a line chart with a legend and 3 lines drawn. When you click the legend the lines show/hide and the graph adjusts accordingly. Out of the box the datalabels do not hide whenever a line is hidden. I am currently using this method of hiding the datalabels:
This works, but the
_meta[0].hidden
thing seems like a hack/not something we're supposed to be using. Is there a different approach that is more stable?The text was updated successfully, but these errors were encountered: