tsg-web/src/views/Home/MapCtrl/Pops/ShenLiu/drpOption.js

174 lines
3.9 KiB
JavaScript
Raw Normal View History

2024-10-15 14:46:55 +08:00
export default function drpOption(data,yjData) {
2024-09-20 15:02:50 +08:00
console.log("data",data);
const maxVal = 0//Math.max(...data.map(obj => obj.drp))
2024-10-15 14:46:55 +08:00
const max1 = Math.max(...[...data.map(obj => obj.value),...yjData.map(obj => obj.value)])
const min1 = Math.min(...[...data.map(obj => obj.value),...yjData.map(obj => obj.value)])
2024-09-20 15:02:50 +08:00
const max2 = Math.max(...data.map(obj => obj.rz))
const min2 = Math.min(...data.map(obj => obj.rz))
2024-10-15 14:46:55 +08:00
const yj = yjData?.map((item,index)=>{
return {
yAxisIndex: 0,
name: item.yjName,
type: 'line',
color: item.color,
lineStyle: {
type: "dashed",
width: 1,
},
data: data.map(o => item.value),
symbol: 'none', // 设置标记点为'none',即去掉圆点
smooth: 0.5
}
})
2024-09-20 15:02:50 +08:00
return {
tooltip: {
trigger: 'axis',
},
grid: [
{
top: "12%",
left: "10%",
right: "8%",
width: '80%',
height: '75%'
},
],
legend: {
top:'3%',
// 显示图例
show: true,
// 图例的位置
data: ["流量"],
},
xAxis: [
{
type: 'category',
data: data.map(o => o.tm),
2024-09-29 10:47:10 +08:00
inverse: false,
2024-09-20 15:02:50 +08:00
splitLine: {
show: false
},
axisLabel: {
padding: [0, 0, 100, 0],
color: '#333',
fontSize: 12,
formatter: val => val.slice(0,10)
},
axisLine: {
lineStyle: {
color: '#d9d9d9',
width: 1,
}
},
axisTick: {
show: false,
},
}
],
yAxis: [
{
// gridIndex: 1,
type: 'value',
position: 'left',
name: "流量(L/s)",
nameTextStyle: {
padding: [0, 0, 10, 10],
color:'#333333',
fontSize: 14
},
splitLine: {
show: true,
lineStyle: {
color: '#bfbfbf',
width: 0.5,
type: 'dotted'
}
},
axisLabel: {
color: '#333',
fontSize: 12,
},
axisLine: {
show: false
// lineStyle: {
// color: '#8c8c8c',
// width: 1,
// }
},
axisTick: {
show: false,
},
2024-10-15 14:46:55 +08:00
min: Math.floor(min1*0.8),
max: Math.ceil(max1*1.2),
2024-09-20 15:02:50 +08:00
},
// {
// // gridIndex: 1,
// type: 'value',
// position: 'right',
// name: "库水位(m)",
// nameTextStyle: {
// padding: [0, 0, 10, 10],
// color:'#333333',
// fontSize: 14
// },
// splitLine: {
// show: false,
// lineStyle: {
// color: '#07a6ff',
// width: 0.25,
// type: 'dotted'
// }
// },
// axisLabel: {
// color: '#333',
// fontSize: 12,
// },
// axisLine: {
// show: false
// // lineStyle: {
// // color: '#8c8c8c',
// // width: 1,
// // }
// },
// axisTick: {
// show: false,
// },
2024-10-15 14:46:55 +08:00
// min: Math.floor(min2*0.8),
// max: Math.ceil(max2*1.2),
2024-09-20 15:02:50 +08:00
// }
],
series: [
{
// xAxisIndex: 1,
// yAxisIndex: 0,
name: '流量',
type: 'line',
color: "#d6eaec",
lineStyle: {
// type: "dashed"
},
data: data.map(o => o.value),
symbol: 'none', // 设置标记点为'none',即去掉圆点
smooth: 0.5
},
2024-10-15 14:46:55 +08:00
...yj
2024-09-20 15:02:50 +08:00
// {
// // xAxisIndex: 1,
// yAxisIndex: 1,
// name: '库水位',
// type: 'line',
// color: "#60a0f8",
// lineStyle: {
// // type: "dashed"
// },
// data: data.map(o => o.rz),
// symbol: 'none', // 设置标记点为'none',即去掉圆点
// smooth: 0.5
// },
]
};
}