Page 1 of 1

How to prevent display uncategorised data

Posted: Mon Aug 15, 2022 2:11 pm
by aris182
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!

Re: How to prevent display uncategorised data

Posted: Tue Aug 16, 2022 11:25 am
by kamil.m
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!

Re: How to prevent display uncategorised data

Posted: Tue Aug 16, 2022 1:39 pm
by aris182
Hi Kamil,

Yes, it works perfectly.

Thank you very much for a quick reply!

Re: How to prevent display uncategorised data

Posted: Tue Aug 16, 2022 2:51 pm
by kamil.m
You're welcome! I'm glad that I could help.

Feel free to contact us anytime,
Regards!