| | |
| | | import * as echarts from 'echarts' |
| | | require('echarts/theme/macarons') // echarts theme |
| | | import resize from './mixins/resize' |
| | | import { getTopProcess } from "@/api/main/da/passingStationCollection/passingStationCollection"; |
| | | |
| | | export default { |
| | | mixins: [resize], |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | chart: null |
| | | chart: null, |
| | | data: [], |
| | | title:[], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | this.getData() |
| | | |
| | | }, |
| | | beforeDestroy() { |
| | | if (!this.chart) { |
| | |
| | | this.chart = null |
| | | }, |
| | | methods: { |
| | | getData(){ |
| | | getTopProcess().then(res => { |
| | | if (res.code === 200){ |
| | | this.data = res.rows |
| | | this.data.forEach(x => { |
| | | this.title.push(x.name) |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | initChart() { |
| | | this.chart = echarts.init(this.$el, 'macarons') |
| | | |
| | |
| | | left: 'left', |
| | | // left: 'center', |
| | | // bottom: '10',//左侧高度 |
| | | data: ['OP460', 'OP090', 'OP660', 'OP650', 'OP730'] |
| | | data: this.title |
| | | }, |
| | | series: [ |
| | | { |
| | |
| | | // length: 10 // 调整标签线的长度 |
| | | // }, |
| | | center: ['50%', '60%'], |
| | | data: [ |
| | | { value: 5, name: 'OP460' }, |
| | | { value: 9, name: 'OP090' }, |
| | | { value: 5, name: 'OP660' }, |
| | | { value: 5, name: 'OP650' }, |
| | | { value: 7, name: 'OP730' } |
| | | ], |
| | | data: this.data, |
| | | label: { |
| | | formatter: '{b}: {c} ({d}%)' |
| | | }, |