Echarts 效果圖
image.png
Echarts 繪制折線圖
閑話不多說,直接到觀眾老爺們最喜歡的上代碼環(huán)節(jié)
js代碼
data = [
['category', '單個(gè)任務(wù)體積'],
['2019-08-26', 811.123],
['2019-08-27', 628.103],
['2019-08-28', 422.714],
['2019-08-29', 512.275],
['2019-08-30', 623.74],
['2019-08-31', 712],
['2019-09-01', 521.456],
['2019-09-02', 612.338],
];
var option = {
dataset: {
source: data,
},
lineStyle: {
color: '#00ffff',
},
title: {
text: '單個(gè)任務(wù)體積=當(dāng)前總體積數(shù)/當(dāng)前總?cè)蝿?wù)數(shù)量',
left: 'right', //設(shè)置標(biāo)題對(duì)其方式為左對(duì)齊
textStyle: {
// fontSize:14
},
},
tooltip: {
trigger: 'axis',
formatter: function (params) {
params = params[0];
//當(dāng)鼠標(biāo)移動(dòng)顯示每個(gè)item
return params.value[0] + ' : ' + params.value[1];
},
axisPointer: {
animation: false,
},
},
grid: {
bottom: '15%',
},
xAxis: {
type: 'time',
splitLine: {
show: false,
},
},
yAxis: {
name: '單位(千方)',
type: 'value',
boundaryGap: [0, '100%'],
min: 0,
max: 1000,
interval: 100,
splitLine: {
show: false,
},
},
series: [
{
name: '模擬數(shù)據(jù)',
type: 'line',
showSymbol: false,
hoverAnimation: false,
},
],
};