Files
gnss-tool-kit/src/render/components/WaterLevel.vue

52 lines
996 B
Vue
Raw Normal View History

2021-11-15 15:49:48 +08:00
<template>
2024-03-25 14:52:39 +08:00
<VChart id="myWaterLevel" :option="option" />
2021-11-15 15:49:48 +08:00
</template>
<script lang="ts" setup>
2024-03-25 14:52:39 +08:00
import { reactive, onMounted } from "vue";
2021-11-15 15:49:48 +08:00
import { use } from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
import { TitleComponent } from "echarts/components";
import 'echarts-liquidfill'
import VChart from "vue-echarts";
use([
CanvasRenderer,
2021-11-16 12:04:45 +08:00
TitleComponent
2021-11-15 15:49:48 +08:00
]);
2024-03-25 14:52:39 +08:00
onMounted(() => {
var mychart = document.getElementById("myWaterLevel");
mychart.firstChild.style.margin = "auto";
});
2021-11-15 15:49:48 +08:00
const option = reactive({
title: {
text: '海拔',
2021-11-27 16:11:30 +08:00
left: 'center',
textStyle: {
color: '#fff'
}
2021-11-15 15:49:48 +08:00
},
2021-11-16 12:04:45 +08:00
series: [{
type: 'liquidFill',
backgroundStyle: {
color: 'transparency'
},
label: {
fontSize : 36,
2021-11-16 12:04:45 +08:00
formatter: function({ value }) {
2021-11-23 07:54:17 +08:00
return parseInt(value)
2021-11-16 12:04:45 +08:00
}
},
2021-11-24 07:57:42 +08:00
data: [0, 0.5, 0.4, 0.3]
2021-11-16 12:04:45 +08:00
}]
2021-11-15 15:49:48 +08:00
})
2021-11-23 07:54:17 +08:00
const update = (alt: number) => {
option.series[0].data[0] = alt
}
2021-11-15 15:49:48 +08:00
defineExpose({ update })
</script>