idscene
Posts: 16
Joined: Thu Apr 07, 2016 8:22 am

Bar chart, Can we set minPointLength of each bar ?

Hello sir,

I have a question about some function of the bar chart, after I plot the chart I found some value disappear affected by a big different value, and I know the highcharts give me the "minPointLength" for set minimum length for the bar. but I wondering, Is it possible or the way to set minPointLength inside each bar such as
series: [{
name: 'John',
data: [ { y: 5, minPointLength: 100 }, { y: 3, minPointLength: 200 }, { y: 4, minPointLength: 50 }, { y: 7, minPointLength: 150 }, { y: 2, minPointLength: 25 }],
}
because as I see it seem effect only in series level. :(

Image

This below is my example:

Thank you for your advice. :)
bastss
Site Admin
Posts: 1192
Joined: Wed Oct 17, 2018 10:59 am

Re: Bar chart, Can we set minPointLength of each bar ?

Hello idscene,

The way to achieve this length is by creating 'fake' y value and set it to required distance, but it will change displayed value in a tooltip. To fix it we also need to edit displayed tooltip label by formatter API: https://api.highcharts.com/highcharts/tooltip.formatter. DEMO: https://jsfiddle.net/Bastss/vm103sgr/. In this example, first series is 100 times bigger than true value and the second series is 10 times bigger. But look at this series with 100 times bigger distance. Notice that this disturbed chart scale and have an unrealistic impression of the presented data. If you want to continue this chart you should find the golden mean between true value and distance. In my opinion, a better solution will be to create 2 yAxis.

Kind regards!
Sebastian Wędzel,
Highcharts Developer
idscene
Posts: 16
Joined: Thu Apr 07, 2016 8:22 am

Re: Bar chart, Can we set minPointLength of each bar ?

Hello bastss, It's the way that I'm looking for. Thank you for your advice, explanation and your example. :)
bastss wrote: Fri Nov 23, 2018 3:04 pm Hello idscene,

The way to achieve this length is by creating 'fake' y value and set it to required distance, but it will change displayed value in a tooltip. To fix it we also need to edit displayed tooltip label by formatter API: https://api.highcharts.com/highcharts/tooltip.formatter. DEMO: https://jsfiddle.net/Bastss/vm103sgr/. In this example, first series is 100 times bigger than true value and the second series is 10 times bigger. But look at this series with 100 times bigger distance. Notice that this disturbed chart scale and have an unrealistic impression of the presented data. If you want to continue this chart you should find the golden mean between true value and distance. In my opinion, a better solution will be to create 2 yAxis.

Kind regards!
bastss
Site Admin
Posts: 1192
Joined: Wed Oct 17, 2018 10:59 am

Re: Bar chart, Can we set minPointLength of each bar ?

You're welcome! :)
Sebastian Wędzel,
Highcharts Developer

Return to “Highcharts Usage”