
const getDoublePieChart = (data1, data2) => {
  const colorList = ['#8AC4FF', '#FFD591']
  const colorList1 = ['#055FC2', '#FFA940']
  let option = {
    series: [
      {
        type: 'pie',
        radius: [35, 78],
        // height: '100%',
        left: 'center',
        // width: '100%',
        itemStyle: {
          borderColor: '#fff',
          borderWidth: 1
        },
        label: {
          position: 'inside',
          fontSize: '16px',
          fontWeight: 700,
          // color: '#333'
        },
        data: data1.map(item => {
          return {
            name: item.name,
            value: item.value,
            itemStyle: {
              color: item.name === '参议院' ? '#055FC2' : '#FFA940'
            }
          }
        })
      },
      {
        type: 'pie',
        radius: [80, 110],
        height: '100%',
        left: 'center',
        width: '98%',
        itemStyle: {
          borderColor: '#fff',
          borderWidth: 1
        },
        label: {
          alignTo: 'edge',
          formatter: '{name|{b}}\n{time|{c} 条 {d}%}',
          minMargin: 5,
          edgeDistance: 10,
          lineHeight: 20,
           rich: {
            name: {
              color: 'rgba(59, 65, 75, 1)',
              fontFamily: 'Microsoft YaHei',
              fontSize: 14,
              fontWeight: 'bold',
              padding: [10,0,10,0]
            },
            time: {
              fontSize: 14,
              fontFamily: 'Microsoft YaHei',
              color: '#rgba(95, 101, 108, 1)',
              padding: [10,0,10,0]
            }
          }
        },
        labelLine: {
          length: 15,
          length2: 0,
          maxSurfaceAngle: 80
        },
        labelLayout: function (params) {
          const isLeft = params.labelRect.x < 556 / 2;
          const points = params.labelLinePoints;
          // Update the end point.
          points[2][0] = isLeft
            ? params.labelRect.x
            : params.labelRect.x + params.labelRect.width;
          return {
            labelLinePoints: points
          };
        },
        data: data2.map(item => {
          return {
            name: item.name,
            value: item.value,
            itemStyle: {
              color: item.type === '参议院' ? '#8AC4FF' : '#FFD591'

            }
          }
        })
      }


    ]
  }
  return option
}

export default getDoublePieChart;