修改图表

master
夜笙歌 1 year ago
parent b219e93f71
commit 6b30d765bc

@ -96,6 +96,7 @@ body {
border-radius: 3px;
border: 2px solid #3f65a1;
padding: 5%;
overflow: auto;
}
.winDiv .title2 {
@ -117,6 +118,7 @@ body {
border-radius: 3px;
border: 2px solid #3f65a1;
padding: 5%;
overflow: auto;
}
.status {

@ -88,20 +88,33 @@ $(() => {
})
})
let chart = null
let chart1 = (el, data) => {
console.log('chart', chart)
let xData = Object.keys(data?.[0] || {})?.filter(e => e !== 'time') || []
let series = xData.map(e => {
let dataA = data?.map(val => val[e]) || []
let isBig = false
dataA.forEach(e => {
if (e > 40) {
isBig = true
}
})
return {
name: e,
type: "line",
smooth: true,
symbol: "circle",
yAxisIndex: isBig ? 1 : 0,
symbolSize: 5,
showSymbol: false,
data: data?.map(val => val[e]) || [],
data: dataA,
}
})
let chart = echarts.init(el);
if (!chart) {
chart = echarts.init(el)
}
console.log('chart', chart)
let option = {
tooltip: {
trigger: "axis",
@ -175,6 +188,29 @@ let chart1 = (el, data) => {
},
},
},
{
type: "value",
name: "转速n/s",
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#57617B",
},
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 14,
},
},
splitLine: {
lineStyle: {
color: "#57617B",
},
},
},
],
series: series,
};

@ -101,7 +101,9 @@
params.timeInterval=$('#timeInterval1').val();
$.get(ctx + 'broad/home/queryParamData', params, (e) => {
if (e.data.length > 0) {
$("#chart1").empty()
$('#chart1').remove()
$("#modal1 .centerModal .centerModalInfo").append('<div class="chart1" id="chart1"></div>')
chart = null
chart1(document.getElementById('chart1'), e.data)
} else {
$("#chart1").html(`<div style="width: 100%;height: 100%;text-align: center;line-height:35vw;color: #fff ">暂无数据</div>`)

Loading…
Cancel
Save