quanyawei
2024-09-12 9251f709dc2a0d278ef2c0cdd76a244bfefc5784
src/views/toCarryOutLegislativeReforms/summaryPage/components/pollutionClassificationEcharts.vue
@@ -1,5 +1,8 @@
<template>
  <div :class="className" :style="{ height: height, width: width }" />
  <div
    :class="className"
    :style="{ height: height, width: width }"
  />
</template>
<script>
@@ -28,7 +31,7 @@
      default: () => []
    }
  },
  data() {
  data () {
    return {
      chart: null,
      seriesData: []
@@ -36,7 +39,7 @@
  },
  watch: {
    'chartData': {
      handler(newVal) {
      handler (newVal) {
        console.log('newVal', newVal)
        this.seriesData = []
        this.seriesData = newVal
@@ -48,12 +51,12 @@
      immediate: true
    }
  },
  mounted() {
  mounted () {
    this.$nextTick(() => {
      this.initChart()
    })
  },
  beforeDestroy() {
  beforeDestroy () {
    if (!this.chart) {
      return
    }
@@ -61,12 +64,12 @@
    this.chart = null
  },
  methods: {
    initChart() {
    initChart () {
      this.chart = echarts.init(this.$el, 'macarons')
      this.chart.clear()
      this.setOptions()
    },
    setOptions() {
    setOptions () {
      // function fontSize(res) {
      //     let clientWidth =
      //         window.innerWidth ||
@@ -97,7 +100,7 @@
                  fontSize: 16
                },
                value: {
                  width: 20,
                  width: 100,
                  align: 'right',
                  fontFamily: 'Medium',
                  fontSize: 16
@@ -148,4 +151,3 @@
  }
}
</script>