时间型条型图,数据全部在series中的data渲染,当某些数据项为null时,并不能很好的显示,怎么修改提示框中的显示的内容为‘’或者 ‘-’
配置项如下
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
label: {
show: true,
precision: '2',
formatter: function(params) {
let str = new Date(params.value).toJSON()
return str.slice(0, 10) + ' ' + str.slice(11, 19)
}
}
},
backgroundColor: 'rgba(255, 255, 255, .8)',
borderColor: '#ddd',
textStyle: {
color: '#333'
},
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);'
},
grid: {
left: 70,
right: 30,
top: 20
},
xAxis: {
type: 'time',
interval: 1000 * 60 * 2,
splitLine: {
show: false
},
axisLabel: {
formatter: '{value}'
},
axisTick: {
length: 2
}
},
yAxis: {
type: 'value',
axisLabel: {
formatter: `{value} %`
}
},
series: [{
name: 'demo',
type: 'line',
connectNulls: false,
smooth: true,
symbol: 'circle',
symbolSize: 5,
showSymbol: false,
lineStyle: {
normal: {
width: 1
}
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(0, 136, 212, 0.3)'
}, {
offset: 0.8,
color: 'rgba(0, 136, 212, 0)'
}], false),
shadowColor: 'rgba(0, 0, 0, 0.1)',
shadowBlur: 10
}
},
itemStyle: {
normal: {
color: 'rgb(0,136,212)',
borderColor: 'rgba(0,136,212,0.2)',
borderWidth: 12
}
},
data: [
[1513578540000, 0.6],
[1513578600000, 0.3],
[1513578660000, 0.3],
[1513578720000, 0.3],
[1513578780000, 0.2],
[1513578840000, 0.4],
[1513578900000, 0.2],
[1513578960000, 0.4],
[1513579020000, 0.2],
[1513579080000, 0.4],
[1513579140000, 0.4],
[1513579200000, 0.3],
[1513579260000, 0.3],
[1513579320000, 0.2],
[1513579380000, 0.5],
[1513579440000, 0.1],
[1513579500000, 0.3],
[1513579560000, 0.4],
[1513579620000, 0.3],
[1513579680000, 0.2],
[1513579740000, 0.4],
[1513579800000, 0.2],
[1513579860000, 0.2],
[1513579920000, 0.3],
[1513579980000, 0.4],
[1513580040000, null],
[1513580100000, null],
[1513580160000, 0.4],
[1513580220000, 0.4],
[1513580280000, 0.2],
[1513580340000, 0.3],
[1513580400000, 0.1],
[1513580460000, 0.3],
[1513580520000, 0.4],
[1513580580000, 0.3],
[1513580640000, 0.4],
[1513580700000, 0.4],
[1513580760000, 0.2],
[1513580820000, 0.1],
[1513580880000, 0.3],
[1513580940000, 0.4],
[1513581000000, 0.7],
[1513581060000, 0.6],
[1513581120000, 0.6],
[1513581180000, 0.5],
[1513581240000, 0.7],
[1513581300000, 0.6],
[1513581360000, 0.5],
[1513581420000, 0.5],
[1513581480000, 0.6],
[1513581540000, 0.4],
[1513581600000, 0.5],
[1513581660000, 0.5],
[1513581720000, 0.6],
[1513581780000, 0.6],
[1513581840000, 0.6],
[1513581900000, 0.6],
[1513581960000, 0.5],
[1513582020000, 0.6],
[1513582080000, 0.5],
[1513582140000, 0]
]
}]
};