Page 1 of 1

Bar chart, Can we set minPointLength of each bar ?

Posted: Fri Nov 23, 2018 9:49 am
by idscene
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. :)

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

Posted: Fri Nov 23, 2018 3:04 pm
by bastss
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!

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

Posted: Mon Nov 26, 2018 2:43 am
by idscene
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!

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

Posted: Mon Nov 26, 2018 10:19 am
by bastss
You're welcome! :)