66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
|
|
|
|
export default function options(data = []) {
|
|
const maxY = Math.ceil(Math.max(...data?.map(s => s.val)))
|
|
const minY = Math.floor(Math.min(...data?.map(s => s.val)))
|
|
const type = data[0]?.type
|
|
const unit = type == 0 ? 'm³/s' : type == 3 ? 'mm' : 'm'
|
|
return {
|
|
tooltip: {
|
|
trigger: "axis",
|
|
},
|
|
grid: {
|
|
top: 10,
|
|
bottom:135,
|
|
right: 60,
|
|
left:80
|
|
},
|
|
xAxis: {
|
|
type: "category",
|
|
data: data.map(item => item.tm),
|
|
boundaryGap: false,
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: "#d9d9d9",
|
|
},
|
|
},
|
|
axisLabel: {
|
|
color: "#7a869a",
|
|
},
|
|
},
|
|
yAxis: {
|
|
type: "value",
|
|
min: minY,
|
|
max:maxY,
|
|
splitLine: {
|
|
lineStyle: {
|
|
color: "#d9d9d9",
|
|
},
|
|
},
|
|
axisLine: {
|
|
show: false,
|
|
},
|
|
axisLabel: {
|
|
color: "#7a869a",
|
|
formatter: `{value} ${unit}`
|
|
},
|
|
axisTick: {
|
|
show: false
|
|
}
|
|
},
|
|
series: [
|
|
{
|
|
data: data.map(item => item.val),
|
|
type: "line",
|
|
name: data[0]?.typeName,
|
|
lineStyle: {
|
|
color: '#5b8ff9'
|
|
},
|
|
itemStyle: {
|
|
color: '#5b8ff9',
|
|
},
|
|
},
|
|
],
|
|
|
|
}
|
|
} |