Page 1 of 1
Equally spaced columns
Posted: Wed Aug 17, 2022 8:25 am
by shalini
Hi,
I want to place all columns equally spaced in a graph irrespective of interval between them.
As of now my graph looks like:
- uneually spaced columns.PNG (32.33 KiB) Viewed 279 times
But it should be like
- Equally spaced columns.PNG (50.04 KiB) Viewed 279 times
Please help me out in this,
Thanks in advance
Re: Equally spaced columns
Posted: Wed Aug 17, 2022 9:19 am
by hubert.k
Hi shalini!
Thanks for contacting us with your question!
You are looking for
xAxis.ordinal property, which makes sure that points are spaced equally regardless of the time, distance and different similar factors. It is available in the Highstock package. You can check the simple demo below.
Demo: https://jsfiddle.net/BlackLabel/9aupzbqj/
API Reference: https://api.highcharts.com/highstock/xAxis.ordinal
Let me know if you have any further questions.
Regards!
Re: Equally spaced columns
Posted: Wed Aug 17, 2022 9:49 am
by shalini
Hey,
Thank you for stepping in for help, now columns are equally spaced. But labels for columns are messing up
- labels.PNG (20.28 KiB) Viewed 266 times
I want labels for each respective column in slanted format as shown below
- Equally spaced columns.PNG (50.04 KiB) Viewed 266 times
Thanks in advance.
Regards,
Shalini
Re: Equally spaced columns
Posted: Thu Aug 18, 2022 7:16 am
by shalini
Please help me to add labels under each column.
Regards!
Re: Equally spaced columns
Posted: Thu Aug 18, 2022 8:02 am
by hubert.k
shalini,
In your case, you should use
xAxis.tickPositioner function to calculate ticks along with
xAxis.ordinal set to
true. To rotate labels you can use
xAxis.labels.rotation property and set and as you would like to or use the default setting of auto-rotation labels on xAxis based on chart width (or set it individually). You can read more about these properties in the API documentation.
Demo: https://jsfiddle.net/BlackLabel/p3vtz25u/
API Reference: https://api.highcharts.com/highstock/xA ... Positioner
https://api.highcharts.com/highstock/xA ... s.rotation
https://api.highcharts.com/highstock/xA ... toRotation
Let me know if that fits your requirement.
Regards!
Re: Equally spaced columns
Posted: Thu Aug 18, 2022 9:42 am
by shalini
Hi,
This solution fits my requirement, Thanks for your time and help.
Regards,
Shalini
Re: Equally spaced columns
Posted: Thu Aug 18, 2022 10:39 am
by hubert.k
That's great to hear! In case of any further questions, feel free to contact us again.