You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
884 B
44 lines
884 B
6 months ago
|
<!-- @format -->
|
||
|
|
||
|
<template>
|
||
|
<div class="base-bar" id="basebar" ref="BaseBarRef"></div>
|
||
|
</template>
|
||
|
<script>
|
||
|
import { defineComponent } from 'vue';
|
||
|
import { init } from 'echarts';
|
||
|
|
||
|
export default defineComponent({
|
||
|
name: 'BaseBar',
|
||
|
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.BaseBarRef, null, { renderer: 'svg' });
|
||
|
}
|
||
|
this.chartbox.clear();
|
||
|
let option = this.getOption();
|
||
|
this.chartbox.setOption(option, { notMerge: false });
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
</script>
|
||
|
<style lang="less">
|
||
|
.base-bar {
|
||
|
height: 100%;
|
||
|
width: 100%;
|
||
|
}
|
||
|
</style>
|