1、表格宽度自适应浏览器宽度
<script type="text/javascript">
require.config({
paths:{
'echarts':'http://echarts.baidu.com/build/echarts',
'echarts/chart/pie' : 'http://echarts.baidu.com/build/echarts'
}
});
require(
[
'echarts',
'echarts/chart/pie'
],
function (ec) {
//--- 折柱 ---
var myChart = ec.init(document.getElementById('clientchart'));
window.onresize = myChart.resize; //<span style="color:#ff0000;">使表格宽度自适应浏览器宽度</span>
myChart.setOption({
title : {
text: '是否大病',
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient : 'vertical',
x : 'left',
data:['是','否']
},
toolbox: {
show : true,
feature : {
mark : {show: true},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : true,
series : [
{
name:'是否大病',
type:'pie',
radius : '55%',
center: ['50%', '40%'],
data:[
{value:<?=$num_isillness?>, name:'是'},
{value:<?=$outpatiennum_total-$num_isillness?>, name:'否'}
]
}
]
});
}
);
</script>