treemap.vue 1.75 KB
<!-- 性别统计 -->
<template>
  <div>
    <!-- 顶部区域 S-->
    <div class="ipage_top">
      <div class="tit"><img :src="bindIcon('shichang1')" />{{title||chartData.title}}</div>
    </div>
    <div class="ichart">
      <treemap-chart :cdata="chartData" tval="treemap"></treemap-chart>
    </div>
  </div>
</template>
<script>
import mixin from "./mixin";
import mallData from "@/components/Echarts/data";
/**********************************************************/
const chartsConfig = {
  default: {
    //默认
    otherConf: {
      _color: [
        "#77abff",
        "#91e3c5",
        "#ffdc9f",
        "#6ed9f9",
        "#638dfa ",
        "#ffbbd5",
      ],
    },
  },
};
/*******************************************************/
import _ from 'underscore';
export default {
  mixins: [mixin],
  data() {
    return {
      configObj: {},
    };
  },
  created() {},
  methods: {
    getChartsConfig() {
      return chartsConfig;
    },
    loadChartData(params) {
      // this.setChartData();
      this.chartId = this.getChartId(this.ckey);

      if (this.chartId) {
        this.ajaxModuleData().then((data) => {
          this.setChartData(data);
        });
      } else {
        this.setChartData();
      }
    },
    setChartData(data) {
      if(_.isEmpty(data)){
        this.chartData = Object.assign(
        {},
        {
          series: [],
        });
        return ;
      }
      this.chartData = Object.assign(
        {},
        {
          series: [
            {
              name: "全部",
              type: "treemap",
              data: data.treeItems,
            },
          ],
        },
        {
          otherConf: this.configObj.otherConf || {},
        }
      );
    },
  },
};
</script>
<style lang="less">
</style>