Echarts可视化教程

  1. 网站首页
  2. 百度ECharts
  3. ECharts实例
  4. ECharts入门
  5. 地图大全
  6. ECharts官网

百度Echarts饼图系列之多个百分比环形图

var data = [
{
  name: 'HTML5',
  value: 80
},{
  name: 'CSS3',
  value: 39
},{
  name: 'VUE',
  value: 35
},{
  name: 'NODE',
  value: 30
}]

var titleArr= [], seriesArr=[];
colors=[['#389af4', '#dfeaff'],['#ff8c37', '#ffdcc3'],['#ffc257', '#ffedcc'], ['#fd6f97', '#fed4e0']]
data.forEach(function(item, index){
  titleArr.push(
    {
      text:item.name,
      left: index * 25 + 12 +'%',
      top: '75%',
      textAlign: 'center',
      textStyle: {
        fontWeight: 'normal',
        fontSize: '16',
        color: colors[index][0],
        textAlign: 'center',
      },
    }    
  );
  seriesArr.push(
    {
      name: item.name,
      type: 'pie',
      clockWise: false,
      radius: [55, 65],
      itemStyle:  {
        normal: {
          color: colors[index][0],
          shadowColor: colors[index][0],
          shadowBlur: 0,
          label: {
            show: false
          },
          labelLine: {
            show: false
          },
        }
      },
      hoverAnimation: false,
      center: [index * 25 + 12 +'%', '50%'],
      data: [{
        value: item.value,
        label: {
          normal: {
            formatter: function(params){
              return params.value+'%';
            },
            position: 'center',
            show: true,
            textStyle: {
              fontSize: '20',
              fontWeight: 'bold',
              color: colors[index][0]
            }
          }
        },
      }, {
        value: 100-item.value,
        name: 'invisible',
        itemStyle: {
          normal: {
            color: colors[index][1]
          },
          emphasis: {
            color: colors[index][1]
          }
        }
      }]
    }  
  )
});
   
option = {
  backgroundColor: "#fff",
  title:titleArr,
  series: seriesArr
}
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption(option);

点击运行 》

点击展开全文

相关文章

  1. 百度Echarts饼图系列之自定义效果
  2. Chartjs图表之环形图
  3. 百度Echarts饼图系列之科技感环图
  4. 百度Echarts饼图统计图表
  5. 不利用百度Echarts实现一个环形图