修改图表

master
夜笙歌 2 years ago
parent ecc43e335a
commit 3dde34def2

@ -64,7 +64,7 @@ export default defineComponent({
textStyle: { textStyle: {
color: '#000' color: '#000'
}, },
interval: 0, //X // interval: 0, //X
rotate: -40 // rotate: -40 //
}, },
data: [] data: []
@ -175,15 +175,19 @@ export default defineComponent({
const initeCharts = () => { const initeCharts = () => {
let myChart = echarts.init(document.getElementById('myChart')) let myChart = echarts.init(document.getElementById('myChart'))
// //
console.log(state.option)
myChart.setOption(state.option) myChart.setOption(state.option)
} }
const setData = (e) => { const setData = (e) => {
let X = e.SpeedList.map(v => v.time) let X = e.TPList.map(v => v.time)
let Y1 = e.SpeedList.map(v => v.speed) let Y1 = []
let Y2 = e.TPList.map(v => v.temperature) let Y2 = e.TPList.map(v => v.temperature)
let Y3 = e.TPList.map(v => v.press) let Y3 = e.TPList.map(v => v.press)
const {option} = toRefs(state) const {option} = toRefs(state)
X.forEach(res => {
Y1.push(e.SpeedList.find(v => v.time === res)?.speed || 0)
})
console.log(X)
console.log(Y1)
option.value.xAxis.data = X option.value.xAxis.data = X
option.value.series[0].data = Y1 option.value.series[0].data = Y1
option.value.series[1].data = Y2 option.value.series[1].data = Y2

Loading…
Cancel
Save