This project is read-only.

heights not parent container?

Feb 24, 2012 at 10:04 PM

I'm trying to create a chart with a specific width and height.  The size property doesn't support passing a width the height of the chart.  It seems if the chart by default expend to the with of the parent container but the height is always 400px.  What do i need to do so the height is calculated from the height of the parent container of the chart?  

Feb 25, 2012 at 12:24 AM

You have two options to specify the size of the chart:

  1. Use property Width on init chart:
    Highcharts chart = new Highcharts("chart")
            .InitChart(new Chart {Width = 300})
  2. Create CSS style for the div container. For example if your chart has a name "chart" then the ID of the container will be "chart_container". Then write following code to your style sheet:
      #chart_container {
           width: 300px;
           height: 500px;
Nov 16, 2012 at 1:26 PM

Thank you very much Vangi, your post was very helpful for me.

For the benefit of anyone else reading this thread in the future, note that there is also a Height property available in the InitChart method.

chart.InitChart(new Chart {Width = 150, Height = 150});


If you don't explicitly set the height, it seems that 400px will be used, which is hardcoded in highcharts.js.