|
|
|
@ -32,6 +32,7 @@ export default defineComponent({
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
name: 'Histogram',
|
|
|
|
|
expose: ['setData'],
|
|
|
|
|
setup() {
|
|
|
|
|
const state = reactive({
|
|
|
|
|
option: {
|
|
|
|
@ -66,7 +67,7 @@ export default defineComponent({
|
|
|
|
|
interval: 0, //显示所有X轴信息
|
|
|
|
|
rotate: -40 //倾斜角度
|
|
|
|
|
},
|
|
|
|
|
data: ['2023-03-15 08:31', '2023-03-15 08:32', '2023-03-15 08:33', '2023-03-15 08:34', '2023-03-15 08:35', '2023-03-15 08:36', '2023-03-15 08:37', '2023-03-15 08:38', '2023-03-15 08:39']
|
|
|
|
|
data: []
|
|
|
|
|
},
|
|
|
|
|
yAxis: [
|
|
|
|
|
{
|
|
|
|
@ -125,7 +126,7 @@ export default defineComponent({
|
|
|
|
|
{
|
|
|
|
|
name: '速度(千米)',
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: [0, 0, 0, 18, 21, 36, 44, 45, 58, 66],
|
|
|
|
|
data: [],
|
|
|
|
|
symbol: "none",
|
|
|
|
|
// symbolSize: 10,
|
|
|
|
|
yAxisIndex: 0,
|
|
|
|
@ -141,7 +142,7 @@ export default defineComponent({
|
|
|
|
|
{
|
|
|
|
|
name: '温度(℃)',
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: [20, 20, 20, 25, 32, 40, 46, 53, 70, 87],
|
|
|
|
|
data: [],
|
|
|
|
|
yAxisIndex: 1,//对应y轴
|
|
|
|
|
symbol: "none",
|
|
|
|
|
itemStyle: {
|
|
|
|
@ -156,7 +157,7 @@ export default defineComponent({
|
|
|
|
|
{
|
|
|
|
|
name: '压力(Kpa)',
|
|
|
|
|
type: 'line',
|
|
|
|
|
data: [600, 600, 600, 615, 616, 617, 620, 622, 622, 622],
|
|
|
|
|
data: [],
|
|
|
|
|
yAxisIndex: 2,//对应右侧的y轴
|
|
|
|
|
symbol: "none",
|
|
|
|
|
itemStyle: {
|
|
|
|
@ -174,8 +175,21 @@ export default defineComponent({
|
|
|
|
|
const initeCharts = () => {
|
|
|
|
|
let myChart = echarts.init(document.getElementById('myChart'))
|
|
|
|
|
// 绘制图表
|
|
|
|
|
console.log(state.option)
|
|
|
|
|
myChart.setOption(state.option)
|
|
|
|
|
}
|
|
|
|
|
const setData = (e) => {
|
|
|
|
|
let X = e.SpeedList.map(v => v.time)
|
|
|
|
|
let Y1 = e.SpeedList.map(v => v.speed)
|
|
|
|
|
let Y2 = e.TPList.map(v => v.temperature)
|
|
|
|
|
let Y3 = e.TPList.map(v => v.press)
|
|
|
|
|
const {option} = toRefs(state)
|
|
|
|
|
option.value.xAxis.data = X
|
|
|
|
|
option.value.series[0].data = Y1
|
|
|
|
|
option.value.series[1].data = Y2
|
|
|
|
|
option.value.series[2].data = Y3
|
|
|
|
|
initeCharts()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
initeCharts()
|
|
|
|
@ -183,6 +197,7 @@ export default defineComponent({
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
...toRefs(state),
|
|
|
|
|
setData
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|