效果图如下:
这是一个折线图,分别显示一个月、三个月、近半年以及近一年的数据。代码如下:
option = {
color: ['#28A1E3'],
xAxis: {
type: 'category',
data: ['一个月', '三个月', '近半年', '近一年']
},
yAxis: {
type: 'value'
},
series: [{
data: [980, 532, 901, 638],
type: 'line',
symbolSize: 40,
symbol: 'circle',
itemStyle : {
normal: {
label: {
show: true,
color: '#000',
fontSize: 14,
formatter: "{b}\n\n{c}",
position: 'inside',
offset: [0, -14],
},
borderColor: '#217A90',
borderWidth: 1,
}
},
markPoint: {
label: {
show: true
},
symbol: 'roundRect',
symbolOffset:[0, -20],//位置偏移
symbolSize: 0.1,
data : [
{
symbolSize: [1, 1],
label: {
normal: {
show: true,
rich: {
a: {
color: "#FF9200"
}
}
},
emphasis: {
show: false
}
}
}
],
itemStyle: {
normal: {
label: {
show: true,
formatter: "{b}",
position: 'top',
textStyle: {
color: '#000'
}
},
textColor : '#000'
},
emphasis: {
label: {
show: true
}
}
}
},
}]
};