var chartDom = document.getElementById(classify);
var myChart = this.$echarts.init(chartDom,'dark');
var option;
var that=this;
option = {
//将图偏移
grid: {
top: '20%',
// containLabel: true
},
//图例
legend:{
data:that.legend_list[num-3],
top:30,
},
//滑动看数据
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'line', //还可以是shadow
crossStyle: {
color: '#999'
}
},
},
//标题
title: {
text: that.title[num],
left:'center',
},
xAxis: {
boundaryGap: false, //将数值对应下面的标签
//不显示横竖条
splitLine:{
show:false
},
type: 'category',
data: that.yingyang_date[num-3],
axisLabel:{
interval:0,
rotate:50, //前两行将x轴的字倾斜
formatter:function(val, index) {
let len=val.length
let res=val.slice(5,7)+'月'+val.slice(8,len)+'日'
return `{y|${res}}`
},
//每一个字加一个\n val.split('').join('\n')
rich:{
y:{
fontSize:'10px'
}
}
}
},
yAxis: {
//不显示横竖条
splitLine:{
show:false
},
type: 'value',
},
series: that.all_data[num]
}
option.series[0].data = option.series[0].data.map((x, i) => [i-2, x])
option.series[2].data = option.series[2].data.map((x, i) => [i-2, x])
option && myChart.setOption(option);
echats
最新推荐文章于 2024-11-13 15:29:17 发布