echarts图表自适应变化

想要图表跟随盒子变化而变化;加一句话即可:

var myChart = echarts.init($('#chartCont')[0]);
var option = {
title: {
text: ''
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
myChart.setOption(option);
window.onresize = myChart.resize;

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复