Im trying to make my rendered chart fill 100% of the parent div with no success. Is there any way I can remove the gap on the left and right sides?
var chart = new Highcharts.Chart({
chart: {
renderTo: 'chart',
margin: 0,
width: 300,
height: 200,
defaultSeriesType: 'areaspline'
},
series: [{
data: [33,4,15,6,7,8, 73,2, 33,4,25],
marker: {
enabled: false
}
}]
});
I solved it by
UPD:
chart { width: 100%; height: 100%; }
2a. another way is - in case if not possible to define container size during "design" time you can reflow chart after chart load (i.e. call chart.reflow(); ):
See example http://jsfiddle.net/yfjLce3o/
use updateChart function and call chart.reflow() inside that function
call updatechart method every 30 seconds using any refresh mechanism
The issue is because of jquery UI. after rendering your chart call this code to reflow the chart. This fixed my problem
If you remove the options
width: 300, height: 200
like this:it will fill automatically the container.
Set
minPadding
andmaxPadding
to 0, see: http://jsfiddle.net/sKV9d/3/Try this :