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

Problems with scrollable Bar chart

Wed Jan 19, 2022 4:40 am

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

User avatar
michal.f
Posts: 487
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

Wed Jan 19, 2022 3:38 pm

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

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

Re: Problems with scrollable Bar chart

Thu Jan 20, 2022 5:33 am

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.

User avatar
michal.f
Posts: 487
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

Thu Jan 20, 2022 2:20 pm

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

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

Re: Problems with scrollable Bar chart

Tue Jan 25, 2022 8:03 am

Hi Michal,

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

User avatar
michal.f
Posts: 487
Joined: Thu Aug 12, 2021 12:04 pm

Re: Problems with scrollable Bar chart

Tue Jan 25, 2022 10:13 am

You're welcome!

In case of any further questions, feel free to contact us again.
Best regards!
Michał Filipiec
Highcharts Developer

Return to “Highcharts Stock”