Page 1 of 1

Problems with scrollable Bar chart

Posted: Wed Jan 19, 2022 4:40 am
by djay99
I am using the latest highstocks Barchart with scroll. However I am having the following issues.

1. While scrolling, the first label gets shown but not the bar
2. Scrolling fast would only show the index for the last element, not the labels or bar.
3. I need to change the color of the bars based on a condition, I couldn't find a way to do that with current structure for series data

Here is the fiddle that has all the mentioned issues

https://jsfiddle.net/BipinMV/7h1drmqu/86

Re: Problems with scrollable Bar chart

Posted: Wed Jan 19, 2022 3:38 pm
by michal.f
Hello,

Welcome to our forum and thanks for contacting us with your question!

1, 2. The problem arises with more data. You can find the solution to this problem in this thread: https://stackoverflow.com/questions/456 ... sing-xaxis

3. What is the condition on which it would depend?

Best regards!

Re: Problems with scrollable Bar chart

Posted: Thu Jan 20, 2022 5:33 am
by djay99
Hi MichaƂ,

Thanks for the quick revert.

1,2 This looks good after the cropThreshold update! :D
3 - Any condition, let's say if point.name.length % 2 == 0, then red else blue.

Re: Problems with scrollable Bar chart

Posted: Thu Jan 20, 2022 2:20 pm
by michal.f
Hi,

Depending on what you want to achieve, you can do it in one of these ways. Each of them differs in performance, the last one is the most advanced one, but after generating the chart, it draws it again, it is also not a big difference in performance, but still.

1. You can define a color only for individual points:
Demo: https://jsfiddle.net/BlackLabel/25sf61nd/
API: https://api.highcharts.com/highcharts/s ... data.color

2. Also, you can use plotOptions.bar.zones option if you want to change the color for higher values:
Demo: https://jsfiddle.net/BlackLabel/wtLqgvfz/
API: https://api.highcharts.com/highcharts/p ... .bar.zones

3. Or using chart.events.load() callback function to operate on data and update them:
Demo: https://jsfiddle.net/BlackLabel/txa3w6yn/
API: https://api.highcharts.com/highcharts/chart.events.load

Let me know if you have any further questions!
Best regards!

Re: Problems with scrollable Bar chart

Posted: Tue Jan 25, 2022 8:03 am
by djay99
Hi Michal,

Thanks for the solutions, 1 suits my requirement well. :)

Re: Problems with scrollable Bar chart

Posted: Tue Jan 25, 2022 10:13 am
by michal.f
You're welcome!

In case of any further questions, feel free to contact us again.
Best regards!