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
}
}]
});
If you do not provide
width
property to the chart, it should automatically get the width of the container. So just remove the width from the chart and give the containerwidth: 100%
and that should work.If you want a specific width, just change the container width to a specific size. The chart should still be 100% of that size. JSFiddle
Example:
HTML
JS
CSS