
<div class="ordernum" id="ordernum" ref="barChart" v-resize="elResize"></div>
elResize(){
this.barchart && this.barChart.resize()
},
var that = this
this.$nextTick(()=>{
var chart =echarts.init(document.getElementById("ordernum"));//获取dom
var option = {
title: {
text: '标题'
},
// legend: {
// bottom:0,
// },
tooltip: {
trigger: "axis",
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
min: '自定义最小值',
max: '自定义最大值',
},
series: [
{
name: '订单数量',
data: that.y_data,
type: 'line'
}
]
};
chart.setOption(option);
window.addEventListener("resize", () => {//echarts根据页面自适应
chart.resize();
});
})
echarts根据页面自适应
于 2022-09-07 17:25:28 首次发布