列车曲线图调整

This commit is contained in:
dong 2023-10-13 09:56:33 +08:00
parent dfbb1caca5
commit 74c045f890

View File

@ -17,7 +17,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { watch } from 'vue';
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import DraggableDialog from 'src/components/common/DraggableDialog.vue'; import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
@ -59,11 +59,11 @@ function getDataList() {
}); });
} }
const myChart = ref(); let myChart: echarts.EChartsType;
function initEcharts() { function initEcharts() {
const dom = document.getElementById('train-echarts'); const dom = document.getElementById('train-echarts');
if (!dom) return; if (!dom) return;
myChart.value = echarts.init(dom, null, { myChart = echarts.init(dom, null, {
renderer: 'canvas', renderer: 'canvas',
useDirtyRect: false, useDirtyRect: false,
}); });
@ -117,14 +117,14 @@ function initEcharts() {
], ],
}; };
myChart.value.setOption(option); myChart.setOption(option);
} }
watch( watch(
() => lineStore.socketStates, () => lineStore.socketStates,
() => { () => {
getDataList(); getDataList();
myChart.value?.setOption({ myChart?.setOption({
series: [ series: [
{ {
data: speedList, data: speedList,