配置项如下
option = {
tooltip: {
trigger: 'axis',
snap:false,
axisPointer:{
type:'none'
},
},
toolbox: {
feature: {
dataView: {show: true, readOnly: false},
magicType: {show: true, type: ['line', 'bar']},
restore: {show: true},
saveAsImage: {show: true}
}
},
legend: {
data:['蒸发量','降水量','平均温度']
},
grid:{
top:200
},
xAxis:
{
type: 'category',
data: ['1月','yyy','2月','3月'],
axisTick: {
alignWithLabel: true
}
}
,
yAxis: [
{
type: 'value',
name: '水量',
max:500,
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '温度',
}
],
series:[
{
"name": "降水量",
"type": "line",
"data": [
['1月',0],
['2月',10],
['3月',40],
]
},
{
"name": "蒸发量",
"type": "line",
"data": [
['1月',0],
['2月',14],
['3月',20],
]
},
{
"name": "平均温度",
"type": "line",
"yAxisIndex": 1,
"data": [
],
tooltip:{
show:'top'
},
},
{
"name": "第一天:治疗信息11蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量蒸发量",
"type": "custom",
markLine : {
animation:false,
symbol:['circle','none'],
lineStyle: {
color:'blue'
},
data : [
[{coord: ['yyy',0],
label: {
normal: {
formatter: function(name) {
let label = '第一天\n治疗信息11蒸发量蒸发量蒸发量蒸发量\n蒸发量蒸发量蒸发量蒸发量蒸\n发量蒸发量蒸发量蒸发量蒸发量';
let target = ["{a|" + label + "}"];
return target.join("\n");
},
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center',
width:200
},
}
}
},
},
{coord: ['yyy',500], }]
]
},
}
]
};