score:54
Just don't set the height property in HighCharts and it will handle it dynamically for you so long as you set a height on the chart's containing element. It can be a fixed number or a even a percent if position is absolute.
By default the height is calculated from the offset height of the containing element
Example: http://jsfiddle.net/wkkAd/149/
#container {
height:100%;
width:100%;
position:absolute;
}
score:0
I had the same problem and I fixed it with:
<div id="container" style="width: 100%; height: 100%; position:absolute"></div>
The chart fits perfect to the browser even if I resize it. You can change the percentage according to your needs.
score:3
Alternatively, you can directly use javascript's window.onresize
As example, my code (using scriptaculos) is :
window.onresize = function (){
var w = $("form").getWidth() + "px";
$('gfx').setStyle( { width : w } );
}
Where form is an html form on my webpage and gfx the highchart graphics.
score:3
Another good option is, to pass a renderTo HTML reference. If it is a string, the element by that id is used. Otherwise you can do:
chart: {
renderTo: document.getElementById('container')
},
or with jquery:
chart: {
renderTo: $('#container')[0]
},
Further information can be found here: https://api.highcharts.com/highstock/chart.renderTo
score:4
Remove the height will fix your problem because highchart is responsive by design if you adjust your screen it will also re-size.
score:5
When using percentage, the height it relative to the width and will dynamically change along with it:
chart: {
height: (9 / 16 * 100) + '%' // 16:9 ratio
},
score:25
Source: stackoverflow.com
Related Query
- Highcharts - how to have a chart with dynamic height?
- How to have a highcharts chart in a container of a fixed width, and with a horizontal scrollbar?
- Highcharts Angular - How to set chart width and height with percentages?
- How to have multiple highcharts with different series data in vuejs without repeating code
- How to Create a Stacked Column Chart with Dynamic Series in Highcharts
- How to plot stacked bar chart in highcharts with dynamic data?
- Highcharts - how can a chart with multi pies change container height automatic?
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Highcharts : Chart with drilldown how to obtain click event of drill up button
- How to structure Angular with Highcharts and lots of dynamic data
- Add dynamic data to line chart from mysql database with highcharts
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- How to scale Highcharts height on window resize with React
- how to have a chart with no spline and no interpolation in Highcharts?
- How to Build a Column Chart in Highcharts with Data Entered Dynamically Within a CMS
- how to sync height & y-axis baseline of multiple chart in highcharts
- How to match columns height with spline in Highcharts
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- Highcharts - how to export chart with different scale in one click
- How to hardcode chart data in my Model then have my Controller pull it from there to display it. Using Highcharts
- Add different symbols to highcharts chart with dynamic data
- Highcharts line chart all points disappear when have more than one points with same X Axis
- How can I make milestone lines with a GANTT chart using the highcharts library?
- How to change color of bar in column chart with different level of percentage in highcharts
- How to create a solid gauge chart with Highcharts in angular 6?
- How to create pie chart with only 1 series data and have background be a circle
- How can I display crosshair labels on top of the chart with Highcharts
- How to have first level as column chart and second level as Fixed placement columns in drill down highcharts
- How can I get a chart only with legends using highcharts
- How to make highcharts with dynamic datetime range with monthly interval
More Query from same tag
- Highcharts screen fitting issue
- Highchart/ROR - Extract data from database table
- Apply different colors to different words according to their weight using Highcharts API
- How to set up drilldown feature for multiple boxplot series in highcharter?
- How to plot x axis next to 0th y axis tick label in case of negative data?
- Highstock dual x-axis with scrollbar
- Setting dates in the xAxis properly HighCharts
- Django Chartit Not Displaying
- Draw plot bands between 2 points in x axis - Highcharts
- Highcharts, How to show datatable when export PDF and not show pdf when normal
- how to pass template variables to javascript
- mouseOver in Highcharts
- Highcharts - XAxis Label with LineFeed - how to make smaller gap?
- Highcharts - how to create multiple y axis and group the data series
- Highcharts Get rid off bottom line
- Error bars with Highcharter
- tickinterval not working high chart for x axis
- Does this qualify for the Highstock NON-COMMERCIAL LICENSE?
- Setting Highcharts Series and Category data dynamically
- Draw another chart/or series on mouse hover in HighStock
- How to support a legacy style option (like series.color) in Highcharts CSS styled mode
- How to Draw graph in ASP.NET MVC 4 using High-Charts?
- Why isn't Highcharts showing the date formatted on x Axis?
- Highcharts drill down to detailed graph
- set left and right margin in highchart
- What would be an alternative to running Twig for loop inside javascript?
- showing ranks on yaxis in highchart in a manner that 1 is best and 50 is worst
- HighCharts Pattern Fill striped
- How to change the graph
- How can I style highchart select to look like hover?