push
This commit is contained in:
43
lib/component/echarts/components/chart/gauge/BaseGauge.vue
Normal file
43
lib/component/echarts/components/chart/gauge/BaseGauge.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<!-- @format -->
|
||||
|
||||
<template>
|
||||
<div class="base-gauge" id="basegauge" ref="BaseGaugeRef"></div>
|
||||
</template>
|
||||
<script>
|
||||
import { defineComponent } from 'vue';
|
||||
import { init } from 'echarts';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BaseGauge',
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
options: null,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
setOption(obj) {
|
||||
this.options = obj;
|
||||
},
|
||||
getOption() {
|
||||
return this.options;
|
||||
},
|
||||
renderChart() {
|
||||
if (!this.chartbox) {
|
||||
this.chartbox = init(this.$refs.BaseGaugeRef, null, { renderer: 'svg' });
|
||||
}
|
||||
this.chartbox.clear();
|
||||
let option = this.getOption();
|
||||
this.chartbox.setOption(option, { notMerge: false });
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less">
|
||||
.base-gauge {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user