0

Hide zero value in column chart

asked 2021-09-13 16:42:52 +0800

bztom35 gravatar image bztom35
103 4

Is there a way to hide the zero values in the column chart?

For example,

chartWI.getPlotOptions().getColumn().getDataLabels().setEnabled(true);

image description

Thanks

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-14 10:02:50 +0800

cor3000 gravatar image cor3000
6094 2 7
ZK Team

ZKCharts is based on Highcharts. So first you can check whether a feature is available in Highcharts first. If not, it can't be available in ZKCharts.

So when asking a question like:

"How to do X with ZKCharts?"

The first question should actually be:

"How to do X with Highcharts?"

So I googled your question: "highcharts column chart hide zero values" and found this right away:

https://stackoverflow.com/questions/15834687/how-to-hide-zero-values-in-column-chart

They mention either to implement a dataLabel.formatter ignoring the labels for zero values or add NULL values into the series at the position of the zeros, in case you don't want any values there at all.

The related ZKCharts API method to set a label formatter is documented here:

https://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/plotOptions/DataLabels.html#setFormatter-org.zkoss.json.JavaScriptValue-

Did you try that already? Did you encounter any problems doing so?

link publish delete flag offensive edit

Comments

Thank you! I felt like a knucklehead that I didn't connect the ZK Charts was based on Highcharts. Yes, I just formatted input zero values as null and it worked as expected.

bztom35 ( 2021-09-14 10:41:27 +0800 )edit

no worries, I'm glad that's clarified, I assume this will help your future searches for available chart features. If you then don't find the related ZK API (we don't copy every tiny property) there is a method addExtraAttr to add the missing ones. In case of problems feel free to get back here.

cor3000 ( 2021-09-14 11:09:21 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-09-13 16:42:52 +0800

Seen: 7 times

Last updated: Sep 14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More