166 lines
3.3 KiB
JavaScript
166 lines
3.3 KiB
JavaScript
|
|
import echarts from 'echarts/lib/echarts';
|
|
import { format } from 'echarts/lib/export';
|
|
export default function DrpOption(data,num) {
|
|
const minL = Math.floor(Math.min(...data?.map(s => s.q)));
|
|
const maxL = Math.ceil(Math.max(...data?.map(s => s.q)));
|
|
const minS = Math.floor(Math.min(...data?.map(s => s.v)));
|
|
const maxS = Math.ceil(Math.max(...data?.map(s => s.v)));
|
|
let eopts = {
|
|
title: {
|
|
text: `时段总水量:${num.value}${num.unit}m³`,
|
|
top: "0%",
|
|
right: "12%",
|
|
textStyle: {
|
|
fontWeight: "normal",
|
|
fontSize:14
|
|
}
|
|
},
|
|
tooltip: {
|
|
trigger: 'axis',
|
|
},
|
|
grid: {
|
|
top: '20%',
|
|
left: '7%',
|
|
right: '11%',
|
|
bottom: '10%',
|
|
borderWidth: 0
|
|
},
|
|
legend: {
|
|
show: true,
|
|
top: "8%",
|
|
},
|
|
calculable: true,
|
|
xAxis: [
|
|
{
|
|
type: 'category',
|
|
data: data?.map(item => item.tm),
|
|
splitLine: {
|
|
show: false
|
|
},
|
|
axisLabel: {
|
|
color: '#333',
|
|
fontSize: 14,
|
|
// formatter: val => val.substr(0,'2020-11-11 11:11'.length)
|
|
format:"waterXaxis"
|
|
},
|
|
axisLine: {
|
|
lineStyle: {
|
|
color: '#07a6ff',
|
|
width: 0.5,
|
|
}
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
}
|
|
],
|
|
yAxis: [
|
|
{
|
|
type: 'value',
|
|
position: 'left',
|
|
name: "流量(m³/s)",
|
|
nameTextStyle: {
|
|
padding: [0, 0, 0, 30]
|
|
},
|
|
splitLine: {
|
|
show: true,
|
|
lineStyle: {
|
|
color: '#07a6ff',
|
|
width: 0.25,
|
|
type: 'dashed'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
color: '#333',
|
|
fontSize: 12,
|
|
},
|
|
axisLine: {
|
|
show: false
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
min: minL,
|
|
max: maxL
|
|
// max: xMaxVal
|
|
},
|
|
{
|
|
type: 'value',
|
|
position: 'right',
|
|
name:"水量(m³)",
|
|
splitLine: {
|
|
show: true,
|
|
lineStyle: {
|
|
color: '#07a6ff',
|
|
width: 0.25,
|
|
type: 'dashed'
|
|
}
|
|
},
|
|
axisLabel: {
|
|
color: '#333',
|
|
fontSize: 12,
|
|
},
|
|
axisLine: {
|
|
show: false
|
|
},
|
|
axisTick: {
|
|
show: false,
|
|
},
|
|
min: minS - 1,
|
|
max: maxS
|
|
}
|
|
],
|
|
};
|
|
let chartData = {
|
|
series: [
|
|
|
|
{
|
|
name:'流量',
|
|
type:'line',
|
|
smooth: true,
|
|
showSymbol: false,
|
|
symbol: false,
|
|
itemStyle: {
|
|
normal: {
|
|
color: "#FAC858",
|
|
}
|
|
},
|
|
lineStyle: {
|
|
normal: {
|
|
width: 3,
|
|
shadowColor: 'rgba(0,0,0,0.4)',
|
|
shadowBlur: 10,
|
|
shadowOffsetY: 10
|
|
}
|
|
},
|
|
markPoint: {
|
|
data: [{
|
|
name: '最大值',
|
|
type: 'max',
|
|
}],
|
|
},
|
|
data: data?.map(s => s.q),
|
|
},
|
|
{
|
|
name: '水量',
|
|
type: 'bar',
|
|
yAxisIndex:1,
|
|
barWidth: '10%',
|
|
data: data?.map(s => s.v),
|
|
itemStyle: {
|
|
normal: {
|
|
color:"#5773c7"
|
|
},
|
|
},
|
|
label: {
|
|
show: false,
|
|
},
|
|
},
|
|
]
|
|
};
|
|
return {
|
|
eopts,
|
|
chartData
|
|
}
|
|
} |