<template>
  <div class="branch">
    <el-card class="branch-card" shadow="hover">
      <template #header>
        <span>
          <vab-icon icon="donut-chart-fill" />
          {{ __('分布') }}
        </span>
      </template>
      <vab-chart
        class="branch-echart"
        :init-options="initOptions"
        :option="option"
        theme="vab-echarts-theme"
      />
    </el-card>
  </div>
</template>

<script>
  import VabChart from '@/extra/VabChart'

  export default {
    components: {
      VabChart,
    },
    data() {
      return {
        initOptions: {
          renderer: 'svg',
        },
        option: {
          tooltip: {
            trigger: 'item',
          },
          series: [
            {
              name: this.__('访问来源'),
              type: 'pie',
              radius: ['50%', '70%'],
              itemStyle: {
                borderRadius: 10,
                borderColor: '#fff',
                borderWidth: 2,
              },
              emphasis: {
                label: {
                  show: true,
                },
              },
              data: [
                { value: 1048, name: this.__('搜索引擎') },
                { value: 735, name: this.__('直接访问') },
                { value: 580, name: this.__('邮件营销') },
                { value: 484, name: this.__('联盟广告') },
                { value: 300, name: this.__('视频广告') },
              ],
            },
          ],
        },
      }
    },
  }
</script>
