BusinessWaterDistributeChart.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <script>
  2. import apiOperationAnalysis from "@/api/operation/apiOperationAnalysis";
  3. export default {
  4. data() {
  5. return {
  6. option: {
  7. tooltip: {
  8. trigger: 'item'
  9. },
  10. legend: {
  11. bottom: '40',
  12. x:'center',
  13. icon: 'circle'
  14. },
  15. title:[
  16. {
  17. subtext: "单位: m³", //主标题
  18. right: "0%", //标题的位置 默认是left,其余还有center、right属性
  19. bottom: "0px",
  20. subtextStyle: {
  21. color: "rgb(160,160,160)",
  22. fontSize: 14,
  23. fontWeight: "normal",
  24. },
  25. },
  26. ],
  27. series: [
  28. {
  29. name: '用水量',
  30. type: 'pie',
  31. radius: ['30%', '45%'],
  32. center: ['50%','35%'],
  33. data: [
  34. ],
  35. emphasis: {
  36. itemStyle: {
  37. shadowBlur: 10,
  38. shadowOffsetX: 0,
  39. shadowColor: 'rgba(0, 0, 0, 0.5)'
  40. }
  41. }
  42. }
  43. ]
  44. }
  45. }
  46. },
  47. props: {
  48. height: Number,
  49. queryData: Object
  50. },
  51. mounted() {
  52. this.$nextTick(()=>{
  53. this.initChart()
  54. })
  55. },
  56. methods: {
  57. initChart() {
  58. let chart = this.$echarts.init(this.$refs.myChart)
  59. this.chart = chart;
  60. this.$util.chartsResize(this.chart);
  61. this.option = this.$util.dataUtil.circleChartConfig(this.option)
  62. chart.setOption(this.option)
  63. this.getData()
  64. },
  65. getData() {
  66. return apiOperationAnalysis.getEnergyAnalysisWater(this.queryData).then(res=>{
  67. this.option.series[0].data = res;
  68. this.option = this.$util.dataUtil.circleChartConfig(this.option)
  69. this.chart.setOption(this.option)
  70. })
  71. }
  72. }
  73. }
  74. </script>
  75. <template>
  76. <div style="width: 100%" :style="{height: height+'px'}" ref="myChart"></div>
  77. </template>
  78. <style lang="less" scoped>
  79. </style>