stj
Posts: 16
Joined: Tue Jul 06, 2021 9:24 am

Show values permanently over config

Is there a possibility to show values permantly on the graph over config? we can do it with js, but we want to configure it with json.
Is there a possibility to show these values by a rule that is configured in json?

Like this for eg: https://jsfiddle.net/Theresa_Joy/rvpe6oac/9/
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Show values permanently over config

Hello stj,

Thanks for contacting us with your question.

I'm not quite sure if I understood correctly, but if you want to use JSON as a chart config then feel free to do it.
Demo:https://jsfiddle.net/BlackLabel/r96hu0tL/

Let me know if that was what you were looking for, and if not, please provide me with more details.

Best regards!
Mateusz Bernacik
Highcharts Developer
stj
Posts: 16
Joined: Tue Jul 06, 2021 9:24 am

Re: Show values permanently over config

Hi,

As shown in the fiddle I had provided, there is an attribute 'valueBox' which helps to show the data on the graph permanently (not as tooltip) . Is there an attribute in Highcharts which does the same?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Show values permanently over config

Hi stj,

I looked for 'valueBox' attribute but didn't find such. I assume you meant value-box which I think would be a counterpart of Highcharts' data labels. So yes, there is in HS attribute that does exactly the same.
Demo: https://jsfiddle.net/BlackLabel/mvec3zfL/
API reference: https://api.highcharts.com/highcharts/p ... dataLabels

Let me know if you have any further questions!
Best regards!
Mateusz Bernacik
Highcharts Developer
stj
Posts: 16
Joined: Tue Jul 06, 2021 9:24 am

Re: Show values permanently over config

Thank you. Can the dataLabels be conditional too?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Show values permanently over config

Hi stj,

Yes, you can easily implement your logic to show data labels. As an example I have used dataLables.formatter to show only labels with values that are divisible by 2.
Demo:https://jsfiddle.net/BlackLabel/xfv6538z/
API reference: https://api.highcharts.com/highcharts/p ... .formatter

Let me know if you have any further questions!
Best regards!
Mateusz Bernacik
Highcharts Developer
stj
Posts: 16
Joined: Tue Jul 06, 2021 9:24 am

Re: Show values permanently over config

ok but can we do it over JSON config?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Show values permanently over config

Hi stj,

No, unfortunately it is not possible. As you probably know JSON is a data description language and function is not supported data type. In such case, where you want to keep your whole chart config as a JSON, the only viable option to show data labels conditionally is dataLabels.filter, which uses 'pseudo code' to control which data labels should be displayed. Usage and effects should be fairly similar to the example that you shared.

Let me know if you have any further questions!
Best regards!
Mateusz Bernacik
Highcharts Developer
stj
Posts: 16
Joined: Tue Jul 06, 2021 9:24 am

Re: Show values permanently over config

Thank you!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Show values permanently over config

You're welcome! In case of any further questions, feel free to contact us again.
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”