ykzz-web/src/views/SafeWatch/TransformWatch/options.js

194 lines
5.7 KiB
JavaScript
Raw Normal View History

2024-12-31 17:58:52 +08:00
export default function options(data) {
// 缝开度
const kdMin = Math.floor(Math.min(...data.map(item => item.value)));
const kdMax = Math.ceil(Math.max(...data.map(item => item.value)));
// 温度
const tempMin = Math.floor(Math.min(...data.map(item => item.temp)));
const tempMax = Math.ceil(Math.max(...data.map(item => item.temp)));
// 模数
const modulusMin = Math.floor(Math.min(...data.map(item => item.modulus)));
const modulusMax = Math.ceil(Math.max(...data.map(item => item.modulus)));
return {
tooltip: {
trigger: 'axis',
},
legend: {
top:'3%',
data: ['缝开度', '温度', '模数']
},
grid: {
left: 35,
right:120
},
xAxis: [
{
type: 'category',
data: data.map(o => o.tm),
inverse: false,
splitLine: {
show: false
},
axisLabel: {
padding: [0, 0, 100, 0],
color: '#333',
fontSize: 12,
formatter: val => val.slice(0, 10)
},
axisLine: {
lineStyle: {
color: '#8c8c8c',
width: 1,
}
},
axisTick: {
show: false,
},
}
],
yAxis: [
{
type: 'value',
position: 'left',
name: "缝开度(mm)",
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,
},
min: kdMin,
max: kdMax,
},
{
type: 'value',
position: 'right',
offset: 80,
name: "温度(°℃)",
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,
},
min: tempMin,
max: tempMax,
},
{
type: 'value',
position: 'right',
name: "模数(F)",
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,
},
min: modulusMin,
max: modulusMax,
}
],
series: [
{
yAxisIndex: 0,
name: '缝开度',
type: 'line',
color: "#d6eaec",
data: data.map(o => o.value),
symbol: 'none', // 设置标记点为'none',即去掉圆点
smooth: 0.5
},
{
// xAxisIndex: 1,
yAxisIndex: 1,
name: '温度',
type: 'line',
color: "#60a0f8",
lineStyle: {
// type: "dashed"
},
data: data.map(o => o.temp),
symbol: 'none', // 设置标记点为'none',即去掉圆点
smooth: 0.5
},
{
yAxisIndex: 2,
name: '模数',
type: 'line',
// color: "#60a0f8",
lineStyle: {
// type: "dashed"
},
data: data.map(o => o.modulus),
symbol: 'none', // 设置标记点为'none',即去掉圆点
smooth: 0.5
},
]
}
}