djay99
Posts: 3
Joined: Tue Jan 18, 2022 12:37 pm

Problems with scrollable Bar chart

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
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

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!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
djay99
Posts: 3
Joined: Tue Jan 18, 2022 12:37 pm

Re: Problems with scrollable Bar chart

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.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

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!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
djay99
Posts: 3
Joined: Tue Jan 18, 2022 12:37 pm

Re: Problems with scrollable Bar chart

Hi Michal,

Thanks for the solutions, 1 suits my requirement well. :)
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

You're welcome!

In case of any further questions, feel free to contact us again.
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Stock”