今日工作中需要实现折线图的简图,就是只看个大概趋势不展示具体坐标,查阅了文档记录一下。
initCharts(_id, _name, yAxisData, _unit){
if(this[_id]) this[_id].clear();
this[_id] = $echarts.init(document.getElementById(_id));
const options = {
grid: {
left: '6%',
right: 0,
bottom: 20,
top: 10,
containLabel: true
},
xAxis: [{
type: 'time',
axisLabel: {
show: false
},
axisLine: {
show: false
},
axisTick: {
show: false
}
}],
yAxis: [{
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
},
}],
series: [{
type: 'line',
name: _name,
smooth: true,
symbol: 'none',
data: yAxisData,
lineStyle: {
color: '#ffffff'
},
areaStyle: {
color: new $echarts.graphic.LinearGradient(0,0,0,1,[
{
offset: 0,
color: 'rgba(255, 255, 255, 0.5)'
},{
offset: 1,
color: 'rgba(255, 255, 255, 0)'
}
])
}
}]
}
document.getElementById(_id).setAttribute('_echarts_instance_', '');
this[_id].setOption(option);
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
