import * as echarts from "echarts";

const getPieChart1 = (data) => {
  return {
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'vertical',  // 垂直排列
      left: 'left',        // 靠左放置
      top: 'center',       // 垂直居中
      itemGap: 24,
      textStyle: {        // 图例文本样式
        color: '#777',
        fontSize: 12
      },
      show: false
    },
    // color: ['#317ef3', '#fcc31f', '#fc5531'],
    series: [
      {
        name: 'Access From',
        type: 'pie',
        radius: ['40%', '90%'],
        avoidLabelOverlap: false,
        emphasis: {
          label: {
            show: true,
            fontSize: 30,
            fontWeight: 'bold'
          }
        },
        labelLine: {
          show: false
        },
        label: {
          orient: 'vertical',
          show: true,
          formatter: '{b}\n{c}\n{d}%',
          // 防止标签重叠
          position: 'inner',
          alignTo: 'edge',
          margin: 20,
          bleedMargin: 5,
          distanceToLabelLine: 5,
          lineHeight: 16,
          textStyle: {
            color: '#fff',
            fontSize: '12px'
          }
        },
        // 设置饼图半径，为标签留出空间
        data: data
      }
    ]
  }
}

export default getPieChart1;