vamsi426
Posts: 15
Joined: Mon Apr 04, 2022 1:25 pm

How to change bins in histogram based on input given

Hi Team
I need to change the no of bins to be displayed based on the input given in a histogram chart.for ex: if 50 is given , 50 bins should display.
I didn' t find any links from the web . can you please provide any inputs on this ?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: How to change bins in histogram based on input given

Hello vamsi426,
Thanks for contacting us with your question!

A histogram series has an additional option binsNumber to suggest how many bins the histogram should create. You can read more about this here: https://www.highcharts.com/docs/chart-a ... ram-series

Demo: https://jsfiddle.net/BlackLabel/h4qm62ry/
API Reference: https://api.highcharts.com/highcharts/p ... 1649064166

Feel free to ask any further questions!
Regards!
Hubert Kozik
Highcharts Developer
vamsi426
Posts: 15
Joined: Mon Apr 04, 2022 1:25 pm

Re: How to change bins in histogram based on input given

https://jsfiddle.net/nbukfxy4/

here is my code .
i am plotting histogram along with bellcurve. i am trying to change binsNumber(for histogram) but it is not working and not getting updated. can you please help me to get bins number
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: How to change bins in histogram based on input given

Hello vamsi426!

You can read here how to create a histogram in this article: https://www.highcharts.com/docs/chart-a ... -histogram
You can add your data as scatter and then set its visible property to false. After that, you can create a histogram based on this data and use a binsNumberproperty. To add bellcurve and histogram based on one series you should also assign them to separate axes. Check out the demo below to see an example based on the demo you provided.

Demo: https://jsfiddle.net/BlackLabel/s7aeq4w6/14/

Feel free to ask any further questions.
Kind regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Usage”