|
@ -1,8 +1,22 @@ |
|
|
|
|
|
|
|
|
/* 数据 */ |
|
|
/* 数据 */ |
|
|
let nameList = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]; // 类别
|
|
|
let nameList = [ |
|
|
let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303, 503 , 203 ,703 , 903 ]; // 人数
|
|
|
"1月", |
|
|
var yList = [ "1000","800","轻度拥堵","基本畅通","畅通"] |
|
|
"2月", |
|
|
|
|
|
"3月", |
|
|
|
|
|
"4月", |
|
|
|
|
|
"5月", |
|
|
|
|
|
"6月", |
|
|
|
|
|
"7月", |
|
|
|
|
|
"8月", |
|
|
|
|
|
"9月", |
|
|
|
|
|
"10月", |
|
|
|
|
|
"11月", |
|
|
|
|
|
"12月", |
|
|
|
|
|
]; // 类别
|
|
|
|
|
|
let valueList = [ |
|
|
|
|
|
800, 520, 650, 950, 420, 600, 450, 720, 303, 503, 203, 703, 903, |
|
|
|
|
|
]; // 人数
|
|
|
|
|
|
var yList = ["1000", "800", "轻度拥堵", "基本畅通", "畅通"]; |
|
|
/* 数据整合 */ |
|
|
/* 数据整合 */ |
|
|
let dataList = []; |
|
|
let dataList = []; |
|
|
nameList.map((item, index) => { |
|
|
nameList.map((item, index) => { |
|
@ -12,32 +26,37 @@ nameList.map((item, index) => { |
|
|
value: valueList[index], |
|
|
value: valueList[index], |
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
color: { |
|
|
color: { |
|
|
type: 'linear', |
|
|
type: "linear", |
|
|
x: 0, |
|
|
x: 0, |
|
|
y: 0, |
|
|
y: 0, |
|
|
x2: 0, |
|
|
x2: 0, |
|
|
y2: 1, |
|
|
y2: 1, |
|
|
colorStops: [{ |
|
|
colorStops: [ |
|
|
offset: 0, color: '#FFB904' // 0% 处的颜色
|
|
|
{ |
|
|
}, { |
|
|
offset: 0, |
|
|
offset: 1, color: '#FF6969' // 100% 处的颜色
|
|
|
color: "#FFB904", // 0% 处的颜色
|
|
|
}], |
|
|
}, |
|
|
global: false // 缺省为 false
|
|
|
{ |
|
|
|
|
|
offset: 1, |
|
|
|
|
|
color: "#FF6969", // 100% 处的颜色
|
|
|
}, |
|
|
}, |
|
|
borderRadius: 6 |
|
|
], |
|
|
|
|
|
global: false, // 缺省为 false
|
|
|
}, |
|
|
}, |
|
|
label: { show: false } |
|
|
borderRadius: 6, |
|
|
}) |
|
|
}, |
|
|
|
|
|
label: { show: false }, |
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
dataList.push({ |
|
|
dataList.push({ |
|
|
name: item, |
|
|
name: item, |
|
|
value: valueList[index], |
|
|
value: valueList[index], |
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
borderRadius: 6 |
|
|
borderRadius: 6, |
|
|
} |
|
|
}, |
|
|
}) |
|
|
}); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
|
|
|
|
|
|
var options = { |
|
|
var options = { |
|
|
legend: { |
|
|
legend: { |
|
@ -52,47 +71,48 @@ var options = { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
grid: { |
|
|
grid: { |
|
|
top: '25%',//上边距
|
|
|
top: "25%", //上边距
|
|
|
right: '0',//右边距
|
|
|
right: "0", //右边距
|
|
|
left: '0',//左边距
|
|
|
left: "0", //左边距
|
|
|
bottom: "0%", //下边距
|
|
|
bottom: "0%", //下边距
|
|
|
containLabel: true, |
|
|
containLabel: true, |
|
|
}, |
|
|
}, |
|
|
xAxis: { |
|
|
xAxis: { |
|
|
type: 'category', |
|
|
type: "category", |
|
|
data: nameList, |
|
|
data: nameList, |
|
|
axisTick: { |
|
|
axisTick: { |
|
|
show: false //隐藏X轴刻度
|
|
|
show: false, //隐藏X轴刻度
|
|
|
}, |
|
|
}, |
|
|
axisLine: { |
|
|
axisLine: { |
|
|
lineStyle: { |
|
|
lineStyle: { |
|
|
color: "rgba(49, 217, 255, 0.8)" |
|
|
color: "rgba(49, 217, 255, 0.8)", |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
axisLabel: { |
|
|
axisLabel: { |
|
|
show: true, |
|
|
show: true, |
|
|
color: '#B6E6FF', |
|
|
color: "#B6E6FF", |
|
|
fontSize: 8, |
|
|
fontSize: 8, |
|
|
fontFamily: 'Source Han Sans CN-Regular', |
|
|
fontFamily: "Source Han Sans CN-Regular", |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
yAxis: [{ |
|
|
yAxis: [ |
|
|
type: 'value', |
|
|
{ |
|
|
|
|
|
type: "value", |
|
|
name: "", |
|
|
name: "", |
|
|
max: 1200, |
|
|
max: 1200, |
|
|
min: 0, |
|
|
min: 0, |
|
|
splitNumber: 5, |
|
|
splitNumber: 5, |
|
|
nameTextStyle: { |
|
|
nameTextStyle: { |
|
|
color: '#B6E6FF', |
|
|
color: "#B6E6FF", |
|
|
fontSize: 13, |
|
|
fontSize: 13, |
|
|
fontFamily: 'Source Han Sans CN-Regular', |
|
|
fontFamily: "Source Han Sans CN-Regular", |
|
|
align: "left", |
|
|
align: "left", |
|
|
verticalAlign: "center", |
|
|
verticalAlign: "center", |
|
|
}, |
|
|
}, |
|
|
axisLabel: { |
|
|
axisLabel: { |
|
|
fontSize: 13, |
|
|
fontSize: 13, |
|
|
color: '#B6E6FF', |
|
|
color: "#B6E6FF", |
|
|
fontFamily: 'HarmonyOS Sans-Regular', |
|
|
fontFamily: "HarmonyOS Sans-Regular", |
|
|
// formatter:function(value,index){
|
|
|
// formatter:function(value,index){
|
|
|
// return yList[index]
|
|
|
// return yList[index]
|
|
|
// }
|
|
|
// }
|
|
@ -101,60 +121,67 @@ var options = { |
|
|
show: false, |
|
|
show: false, |
|
|
}, |
|
|
}, |
|
|
axisTick: { |
|
|
axisTick: { |
|
|
show: false |
|
|
show: false, |
|
|
}, |
|
|
}, |
|
|
splitLine: { |
|
|
splitLine: { |
|
|
lineStyle: { |
|
|
lineStyle: { |
|
|
color: 'rgba(49, 217, 255, 0.5)', |
|
|
color: "rgba(49, 217, 255, 0.5)", |
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
}], |
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
series: [ |
|
|
series: [ |
|
|
{ |
|
|
{ |
|
|
name: '交通特征', |
|
|
name: "交通特征", |
|
|
type: 'line', |
|
|
type: "line", |
|
|
symbol: 'circle', |
|
|
symbol: "circle", |
|
|
symbolSize: 0, |
|
|
symbolSize: 0, |
|
|
|
|
|
|
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
color: '#32BB8A', |
|
|
color: "#32BB8A", |
|
|
}, |
|
|
}, |
|
|
lineStyle: { |
|
|
lineStyle: { |
|
|
width: 2, |
|
|
width: 2, |
|
|
}, |
|
|
}, |
|
|
data: [1000, 800, 520, 600, 900, 700, 700,1000, 800, 520, 600, 900, 700, 700], // 折线图的数据
|
|
|
data: [ |
|
|
|
|
|
1000, 800, 520, 600, 900, 700, 700, 1000, 800, 520, 600, 900, 700, 700, |
|
|
|
|
|
], // 折线图的数据
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
name: '饱和度', |
|
|
name: "饱和度", |
|
|
type: 'line', |
|
|
type: "line", |
|
|
symbol: 'circle', |
|
|
symbol: "circle", |
|
|
symbolSize: 0, |
|
|
symbolSize: 0, |
|
|
|
|
|
|
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
color: '#07A3FB', |
|
|
color: "#07A3FB", |
|
|
}, |
|
|
}, |
|
|
lineStyle: { |
|
|
lineStyle: { |
|
|
width: 2, |
|
|
width: 2, |
|
|
}, |
|
|
}, |
|
|
data: [600, 700, 900, 400, 500, 800, 600,600, 700, 900, 400, 500, 800, 600], // 折线图的数据
|
|
|
data: [ |
|
|
|
|
|
600, 700, 900, 400, 500, 800, 600, 600, 700, 900, 400, 500, 800, 600, |
|
|
|
|
|
], // 折线图的数据
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
name: '拥挤度', |
|
|
name: "拥挤度", |
|
|
type: 'line', |
|
|
type: "line", |
|
|
symbol: 'circle', |
|
|
symbol: "circle", |
|
|
symbolSize: 0, |
|
|
symbolSize: 0, |
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
// yAxisIndex: 1, // 与第二个 y 轴关联
|
|
|
itemStyle: { |
|
|
itemStyle: { |
|
|
color: '#E2BA74', |
|
|
color: "#E2BA74", |
|
|
}, |
|
|
}, |
|
|
lineStyle: { |
|
|
lineStyle: { |
|
|
width: 2, |
|
|
width: 2, |
|
|
}, |
|
|
}, |
|
|
data: [850, 810, 712, 580, 480, 480, 780,850, 810, 712, 580, 480, 480, 780], // 折线图的数据
|
|
|
data: [ |
|
|
|
|
|
850, 810, 712, 580, 480, 480, 780, 850, 810, 712, 580, 480, 480, 780, |
|
|
|
|
|
], // 折线图的数据
|
|
|
}, |
|
|
}, |
|
|
] |
|
|
], |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
export default options; |
|
|
export default options; |
|
|