score:-3
$(Highcharts.charts).each(function(i,chart){
var height = chart.renderTo.clientHeight;
var width = chart.renderTo.clientWidth;
chart.setSize(width, height);
});
it works for me
score:0
only this worked for me
$(window).resize(function(){
$scope.chartConfig.getChartObj().reflow()
});
score:0
Just want to add another solution:
$('.chart').highcharts(options, function(chart) {
setTimeout(function() {
chart.reflow();
});
});
What it does is reflowing the chart the next frame after it has been rendered.
score:1
Sort of an old topic now, but I had this issue with IE8. The current version of IE at the time of writing this is IE10, but I needed to make my site compatible with earlier versions. The solution that worked for me was a combination of above and other sites where people spoke about the solution they implemented. I went for a settimeout plus a resize and just executed for IE8, I hope this helps someone else like myself who tried to find a solution for a few hours.
You may find just the script section is the only section you require.
<!--[if IE 8]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script>
function timeout() {
$(window).resize();
}
window.setTimeout(function() {
timeout();
},2000);
</script>
<style>
.highcharts-container{width:100% !important; height:100% !important;}
</style>
<![endif]-->
score:1
You can use this code for the example
var chart;
$(function() {
var newh = $("#container").height();
$( window ).resize(function() {
newh = $("#container").height();
chart.redraw();
chart.reflow();
});
chart = new Highcharts.Chart();
})
score:2
You can add an event listener so your chart resizes every time it redraws:
mychart = new Highcharts.stockChart('div', {
chart: {
events: {
redraw: function(e) {
mychart.reflow();
}
}
},
score:2
In pure javascript multiple charts in single page resize issue on window resize
window.onresize = function() {
//- Remove empty charts if you are using multiple charts in single page
//- there may be empty charts
Highcharts.charts = Highcharts.charts.filter(function(chart){
return chart !== undefined;
});
Highcharts.charts.forEach(function(chart) {
var height = chart.renderTo.chartHeight;
//- If you want to preserve the actual height and only want to update
//- the width comment the above line.
//- var height = chart.chartHeight;
var width = chart.renderTo.clientWidth;
//- The third args is an animation set to true.
chart.setSize(width, height, true);
});
};
We need this css code as well
.highcharts-container {
width: 100%;
}
.highcharts-container svg {
width: 100%;
display: flex;
}
score:4
for me, it needed to take some delay and trigger the window resize.
window.setTimeout(function(){ $(window).trigger('resize'); }, 500);
score:9
This might help:
$(Highcharts.charts).each(function(i,chart){
var height = chart.renderTo.clientHeight;
var width = chart.renderTo.clientWidth;
chart.setSize(width, height);
});
score:18
Please take a look at these examples with responsive highcharts:
http://jsbin.com/anuqav/1/edit
http://jsfiddle.net/2gtpA/show/
<div id="container" style="width:100%;margin: 0 auto"></div>
score:21
Just use the chart.reflow()
function
score:38
I got this from another answer, so give thegreyspot some credit in this question.
solution: call $(window).resize();
after the graph is loaded (or when you fill it with data)
Source: stackoverflow.com
Related Query
- Responsive Highcharts not sizing correctly until window resize
- Hidden Highcharts not sizing correctly until window resize
- Highcharts Graph displays correctly ONLY on Window Resize
- Chart not render correctly when maximizing / restoring window or dragging resize bar (SmartGWT)
- highcharts image not resized after window resize
- Highcharts charts don't resize properly on window resize
- Highcharts does not resize charts inside tabs
- Resize highcharts using react-grid-layout not working
- Highcharts Server not loading infile correctly
- Highcharts - CUSTOM DATA LABELS in line series, are disappearing on window resize
- HighCharts scatter plot with Datetime on X Axis not plotting values correctly
- Highcharts - Gauge chart data label not positioning correctly
- How to scale Highcharts height on window resize with React
- Resize highchart based on container changing NOT window resize
- Gauge highcharts is not resize with ionic 2
- Highcharts with boost not rendering correctly at small intervals
- HighCharts - barchart not rendering correctly in IE8
- HighCharts x-axis not displaying correctly
- Highcharts lines not being drawn until browser is resized
- Highcharts - margins update on window resize
- Highcharts export not displaying correctly
- Highcharts window while decreasing not working
- Min/Max yAxis not working correctly in Highcharts
- highcharts 2 variable JSON (Date, Value) not showing correctly
- Highcharts - Column width not responsive
- Highcharts using Django-Chartit. Chart lines not displayed without window resize, or Inspect Element
- Highcharts multiple x axis and yaxis. The width of the 1st x-axis is not in sync with browser resize
- Stack labels not rendered correctly when exporting Highcharts graph
- highcharts waterfall not summing correctly
- tool tip does not work correctly if text is more in highcharts
More Query from same tag
- how to add values from my object to Highchart using Jquery
- how to : specify colors for multiple axes chart?
- how to create a world map using highmaps and disable part of legend?
- Highcharts - Display only one name at each end of the bar's chart
- How to use react-highcharts to plot bell curve
- convert mysql resultset into a (name, data) object to be fed into HighCharts
- Highstock column chart y axis ceiling issue
- Highcharts gauge is render before the data is fetched by json
- Highcharts assign colors to series after using csvURL
- Highcharts heatmap scale one decimal place
- How to pass a JavaScript variable to JQuery
- Highcharts x axis formatting options
- How to accomplish responsive texts in Highcharts gauges?
- Position events below analog area in Highcharts combined line/timeline chart
- [Highcharts][jQuery] How to get DateTime from XML to jQuery
- how to dynamically set the minPointLength except 0
- Highchart - xAxis values are to close
- How to add highcharts plugins into highcharts-vue(highcharts vue wrapper)
- HighCharts not being displayed in Partial view
- Overwrite Highcharts X Axis
- How to aggregate boolean values in elastic search?
- Using ModalEditor from highcharts-editor in Angular5
- Highcharts: multiple yAxes labels overlap
- Highcharts dashed line on x axis not going all the way across
- In high chart how to add event for label click
- Highcharts don't hide categories labels on overflow
- Is a 1D flag chart possible?
- Is there limit on the number of data points to plot HighChart
- Highcharts on Modal Element being Clipped
- Loading data to Highchart from MySQL and displaying in appropriate way