glundgren93
Posts: 18
Joined: Tue Oct 25, 2022 7:25 am

Same scale x and y axis

Hello,

I'm trying to plot a chart where I have the YAxis as height and the XAxis as distance. Both are in meters. Since the height is always smaller than the distance, the chart looks a bit distorted. I tried following this https://stackoverflow.com/questions/269 ... -highchart, but I can't really define the same max on both axes. Is there a way I can define a scale for both axes?

Here is a working example https://jsfiddle.net/glundgren/c4pe6z9h/1450/
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Same scale x and y axis

Hello,

You can use percentages to make height based on width as the documentation itself says:
An explicit height for the chart. If a number, the height is given in pixels. If given a percentage string (for example '56%'), the height is given as the percentage of the actual chart width. This allows for preserving the aspect ratio across responsive sizes.

Demo: https://jsfiddle.net/BlackLabel/j5k1cLgs/
API: https://api.highcharts.com/highcharts/chart.height

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Usage”