Category.vue 1.43 KB
<template>
  <div class="category-box box">
    <div class="title-icon">
      <span class="title-bg">品类业务</span>
    </div>
    <div class="category-container flex">
      <pie-chart ref="pieChartCategory" :id="chart.id" :list="categoryData" :formatter="chart.formatter" :colors="chart.colors"></pie-chart>
      <OperationaLegend class="category-legend" :list="categoryData" :width="'4.17vw'" :height="'2.44vh'" :colors="chart.colors"></OperationaLegend>
    </div>
  </div>
</template>

<script>
import OperationaLegend from './OperationaLegend.vue'
export default {
  name: 'Category',
  components: {
    OperationaLegend
  },
  data() {
    return {
      chart: {
        id: 'category',
        colors: ['#EB6001', '#34AFFF', '#16E193', '#BF98FF'],
        formatter: 'rate'
      }
    }
  },
  props: {
    categoryData: {
      type: Array,
      default: () => []
    }
  },
  methods: {}
}
</script>
<style lang="scss" scoped>
.category-box {
  overflow: hidden;
  height: 13.9vh;
  .title-icon {
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;
    .title-bg {
      background-image: linear-gradient(90deg, #003f57 0%, #111056 54%, #06142200 100%);
      padding-left: 0.83vw;
    }
  }
  .category-container {
    height: 11.34vh;
    // margin: 1.59vh 1.67vw 1.46vh 1.11vw;
    .category-legend {
      width: 4.2vw;
      margin-right: 1.81vw;
    }
  }
}
</style>