html中的代码如下<div id="dash_show" class="container_m"> <div class="row" style="height:60%;margin-top:25px;">
<div class="col-md-9">
<div id="chart_daily_movement">
<div id="chart_daily_movement" style="width:100%;height:320px;"></div>
</div>
</div>
<div><div>
JS文件中的代码function generateChart_movement(h, l) {
var myChart2 = echarts.init(document.getElementById('chart_daily_movement'));
var resizeWorldMapContainer2 = function () {
$("#chart_movement_content").width = window.innerWidth * 0.33 + 'px';
myChart2.resize();
};
option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
x: 'left',
data: ['Average Inventory', 'Shipment', ]
},
color: ['rgb(5,188,254)', 'rgb(156,220,87)'],
toolbox: {
show: false,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
magicType: {
show: true,
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
width: '50%',
funnelAlign: 'center',
max: 1548
}
}
},
restore: { show: true },
saveAsImage: { show: true }
}
},
calculable: true,
series: [
{
name: '',
type: 'pie',
radius: ['50%', '70%'],
itemStyle: {
normal: {
label: {
show: false
},
labelLine: {
show: false
}
},
emphasis: {
label: {
show: true,
position: 'center',
textStyle: {
fontSize: '12',
fontWeight: 'bold'
}
}
}
},
data: [
{ value: h, name: 'Average Inventory' },
{ value: l, name: 'Shipment' },
]
}
]
};
var myChart2 = echarts.init(document.getElementById('chart_daily_movement'));
myChart2.setOption(option);
window.addEventListener("resize", function () { //bootstrap下的resize的实现方法
myChart2.resize();
});
}