IView admin cannot render drain pit using statistical chart data
<script> import { ChartPie, ChartBar } from '_c/charts' export default { name: 'home', components: { ChartPie, ChartBar, }, data () { return { barData: { } } }, mounted () { //Request data, and return successful copy to barData object ... this.barData=res.result; .... } } </script>
watch:{ 'value': function (newVal) { this.gengxinshuju(); } },
this.$nextTick(() => { let xAxisData = Object.keys(this.value) let seriesData = Object.values(this.value) let option = { title: { text: this.text, subtext: this.subtext, x: 'center' }, xAxis: { type: 'category', data: xAxisData }, yAxis: { type: 'value' }, series: [{ data: seriesData, type: 'bar' }] } this.dom = echarts.init(this.$ refs.dom, 'tdTheme') this.dom.setOption(option) on(window, 'resize', this.resize) })