1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <script>
- import apiOperationAnalysis from "@/api/operation/apiOperationAnalysis";
- export default {
- data() {
- return {
- option: {
- tooltip: {
- trigger: 'item'
- },
- legend: {
- bottom: '40',
- x:'center',
- icon: 'circle'
- },
- title:[
- {
- subtext: "单位: m³", //主标题
- right: "0%", //标题的位置 默认是left,其余还有center、right属性
- bottom: "0px",
- subtextStyle: {
- color: "rgb(160,160,160)",
- fontSize: 14,
- fontWeight: "normal",
- },
- },
- ],
- series: [
- {
- name: '用水量',
- type: 'pie',
- radius: ['30%', '45%'],
- center: ['50%','35%'],
- data: [
- ],
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)'
- }
- }
- }
- ]
- }
- }
- },
- props: {
- height: Number,
- queryData: Object
- },
- mounted() {
- this.$nextTick(()=>{
- this.initChart()
- })
- },
- methods: {
- initChart() {
- let chart = this.$echarts.init(this.$refs.myChart)
- this.chart = chart;
- this.$util.chartsResize(this.chart);
- this.option = this.$util.dataUtil.circleChartConfig(this.option)
- chart.setOption(this.option)
- this.getData()
- },
- getData() {
- return apiOperationAnalysis.getEnergyAnalysisWater(this.queryData).then(res=>{
- this.option.series[0].data = res;
- this.option = this.$util.dataUtil.circleChartConfig(this.option)
- this.chart.setOption(this.option)
- })
- }
- }
- }
- </script>
- <template>
- <div style="width: 100%" :style="{height: height+'px'}" ref="myChart"></div>
- </template>
- <style lang="less" scoped>
- </style>
|