1. 首页
  2. 百度ECharts
  3. ECharts实例
  4. ECharts入门
  5. ECharts官网
  6. Gallery

百度pie图表自带轮播

2021年02月01日 15:13:36

百度pie图表自带轮播,和tooltip切换各自独立,不受影像。代码如:

var data = [
	{value:335, name:'天使轮', selected:true},
	{value:679, name:'A轮'},
	{value:1548, name:'B轮'},
	{value:679, name:'C轮'},
	{value:679, name:'D轮及以上'},
	{value:679, name:'战略运作'}
];
var count = 0;
option = {
    backgroundColor: '#040c33',
    color: ['#3c13a8', '#4d59e6', '#5c63c5', '#0472d9', '#42947f', '#4eb2d4'],
    series: [
        {
            type:'pie',
            selectedMode: 'single',
            selectedOffset: 20,
            radius: [0, '30%'],
            label: {
                normal: {
                    show: false
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:data
        },
        {
            type:'pie',
            selectedMode: 'single',
            selectedOffset: 20,
            radius: ['40%', '55%'],
            label: {
                normal: {
                    show: true,
                    textStyle: {
                      fontSize: 24,
                      color: '#ade3ff'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            itemStyle: {
              normal:{
                 opacity:0.6
              }  
            },
            data:data
        }
    ]
};
app.timeTicket = setInterval(function() {
    var r = count % data.length;
    option.series[0].data[r].selected = false;
    option.series[1].data[r].selected = false;
    count++;
    var s = count % data.length;
    option.series[0].data[s].selected = true;
    option.series[1].data[s].selected = true;
    myChart.setOption(option, true);
}, 1000);
点击展开全文
百度pie图表自带轮播