How to dynamically change the size of a Highcharts chart

 

How to dynamically change the size of a Highcharts chart

Set the margin property of the chart, the code is as follows ;

view sourceprint?
$(function () {
$('#container').highcharts({
chart: {
type: 'line',
margin: [0, 0, 0, 0 ] //The distance value from top, bottom, left and right
},

xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', ' Sep', 'Oct', 'Nov', 'Dec']
},

series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});

In this way, the height and width of the chart do not need to be set, only the value of the div needs to be set.
<div id="container" style="height: 400px"></div>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644041&siteId=291194637