效果图
var trend = document.getElementById('fachetrend')
var trenddata = [['06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00'],
[5, 40, 30, 40, 20, 28, 32, 22, 18, 30, 33, 30]]
function trendchart(dom, data) {
var trendchart = echarts.init(dom)
var optiontrend = {
tooltip: {
trigger: 'axis',
showContent: false,
axisPointer: {
type: 'none'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
axisTick: {
show: false
},
axisLabel: {
textStyle: {
color: '#2cf4fd',
fontSize: 16,
}
},
data: data[0]
},
yAxis: {
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: 'rgba(0, 188, 208,0.3)'
}
},
axisLabel: {
textStyle: {
color: '#2cf4fd',
fontSize: 16,
}
},
},
graphic: [
{
type: 'image',
style: {
image: '../img/bgimg/24bghour.png',
x: 70,
y: 35,
width: 680,
height: 220
}
}
],
series: [
{
name: '数量',
type: 'line',
areaStyle: {
color: '#091f3e',
},
symbol: 'image://../img/bgimg/circle.png',
symbolSize: 20,
showSymbol: false,
itemStyle: {
normal: {
lineStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#1e66e1" },
{ offset: 1, color: "#2cf4fd" }
])
}
}
},
label: {
show: true,
color: '#d9fcff',
fontWeight: 'bold',
offset: [0, -6],
align: 'center',
verticalAlign: 'middle',
backgroundColor: {
image: '../img/bgimg/zhexiansh.png'
},
width: 30,
height: 130,
},
data: data[1]
}
]
};
trendchart.setOption(optiontrend);
}
trendchart(trend, trenddata)