I want to resize the chart while keeping a specific aspect ratio of 35CM x 8CM. how i can do this.
i need the size ratio for the plot only, not whole container.
I have write my own logic for this, but it does not produce the required result.
Code: Select all
var width = $('#container2').width();
var ratio = (width - 40 ) / 1322.84; //1322.84 is 35 cm
var height = ratio * 302.36220472 + ratio * 151.18110236 + 114 + 100 ; //302.36220472 is 8 cm, 130 is bottom, 114 is top, 151.18110236
$('#container2').css('height', height);
data_chart.reflow();
fhrheight = '68%';
if (height < 470) {
fhrheight = '69%';
}
var option = {
xAxis: [{
labels: { style: { fontSize: fontsize + 'px' }},
height: fhrheight
}]
}
data_chart.update(option);