Hi,
Is it possible to toggle the DataLabels dynamically in the chart? Setting some values to true or false like isVisible property.
- Mathew George asked 1 year ago
- You must login to post comments
Yes it is, see this related question. This shows how to show and hide datalabels on an individual basis by setting a flag {showLabel: true}
on the metadata.
If you would like to enable/disable ALL datalabels (turn them all on or off) this can be done simply by setting renderableSeries.dataLabelProvider.style.fontSize = 0
. Removing the style should also hide the labels, setting it should add them back. I will notify the team that we should make this easier by providing a dataLabelProvider.isEnabled
or isVisible
property in future builds.
Does that help?
Best regards,
Andrew
- Andrew Burnett-Thompson answered 1 year ago
- last edited 1 year ago
- Update: added a task in our issue tracker to improve this in future https://abtsoftware.myjetbrains.com/youtrack/issue/SCJS-1604/Add-dataLabelProvider.isEnabled-property
- You must login to post comments
Thanks Andrew..
I cannot use meta data for this. In my application what i am planning is like i am having a chart and properties window. From properties window need to hide and show the dataLabels. So its difficult to iterate the all data objects and show and hide the dataLabels. But fontSize 0 will work for me.
- Mathew George answered 1 year ago
- last edited 1 year ago
- Of course – I misunderstood your question initially – thinking you wanted to show/hide specific data labels. To show hide all fontSize: 0 will work, so will removing the fontFamily or style on the dataLabelprovider. I agree we need an isEnabled flag to toggle all the labels, so I’ve created a task for it in future builds (SCJS-1604). Thanks!
- You must login to post comments
Please login first to submit.