aris182
Posts: 3
Joined: Mon Aug 15, 2022 1:56 pm

How to prevent display uncategorised data

Mon Aug 15, 2022 2:11 pm

Hi!
I wonder what is the best way to prevent displaying uncategorised data. For example, if my category array length is 7 and some series data is 10, I want to display only 7 columns in my chart.
I want to dynamically modify the category array and display only the values that fall into a category.

Attached image: How to prevent these 8 and 9 columns from displaying?

Thank you!
Attachments
Screenshot 2022-08-15 150213.png
Screenshot 2022-08-15 150213.png (32.41 KiB) Viewed 61 times

kamil.m
Posts: 620
Joined: Thu May 19, 2022 1:33 pm

Re: How to prevent display uncategorised data

Tue Aug 16, 2022 11:25 am

Hi there,

Welcome to our forum and thank you for contacting us with your question.

There is no built-in functionality like this one, but it's really easy to achieve. Create the categories array outside the Highcharts object, then set xAxis.categories to your array, and then set xAxis.max to yourArray.length - 1. And that's it!

Take a look at the demo below:
https://jsfiddle.net/BlackLabel/L68p54nh/

API Reference: https://api.highcharts.com/highcharts/xAxis.max

Let me know if that's what you were looking for,
Best regards!
Kamil Musiałowski
Highcharts Developer

aris182
Posts: 3
Joined: Mon Aug 15, 2022 1:56 pm

Re: How to prevent display uncategorised data

Tue Aug 16, 2022 1:39 pm

Hi Kamil,

Yes, it works perfectly.

Thank you very much for a quick reply!

kamil.m
Posts: 620
Joined: Thu May 19, 2022 1:33 pm

Re: How to prevent display uncategorised data

Tue Aug 16, 2022 2:51 pm

You're welcome! I'm glad that I could help.

Feel free to contact us anytime,
Regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”