Posts: 1075
Joined: Fri Dec 16, 2022 11:45 am

Re: How to set Butterfly Chart width, left and offset based on parent div width


Welcome to our forum & thanks for the question!

As you can see in the API (https://api.highcharts.com/highcharts/chart.width):
chart.width is a number (pixels) and not a percentage string.

By default it is set to null which means that the chart fills the entire space of the chart-container and has no fixed width.

So, what I would recommend is setting the chart-container's width to a percentage of a parent div in CSS without setting any fixed with with the chart.width option.

Here's a demo: https://jsfiddle.net/BlackLabel/getw6L3x/

If you want chart properties to change depending on the chart's width take a look at the responsive property here - https://api.highcharts.com/highcharts/responsive

Let me know if that helps.

Best regards!
Highcharts Developer

Return to “Highcharts Maps”