鍍金池/ 問答/HTML5  HTML/ 關(guān)于插件echarts

關(guān)于插件echarts

圖片描述

這個(gè)是鼠標(biāo)移進(jìn)去的效果,但是我想進(jìn)入頁面的時(shí)候就有這個(gè)默認(rèn)效果怎么弄,大神們!

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="echarts.js"></script>
</head>

<body>
<!-- 為ECharts準(zhǔn)備一個(gè)具備大?。▽捀撸┑腄om -->
<div id="main" style="width: 335px;height:325px;"></div>
<script type="text/javascript">

// 基于準(zhǔn)備好的dom,初始化echarts實(shí)例
var myChart = echarts.init(document.getElementById('main'));

// 指定圖表的配置項(xiàng)和數(shù)據(jù)

option = {
  tooltip: {
    trigger: 'item'
  },
  series: [{
      name: '學(xué)校錄取信息',
      type: 'pie',
      radius: ['45%', '70%'],
      avoidLabelOverlap: false,
      label: {
        normal: {
          show: false,
          position: 'center'
        },
        emphasis: {
          show: true,
          textStyle: {
            fontSize: '14',
            fontWeight: 'bold'
          }
        }
      },
      labelLine: {
        normal: {
          show: false
        }
      },
      data: [{
          value: 335,
          name: '直接訪問'
        },
        {
          value: 310,
          name: '郵件營銷'
        },
        {
          value: 234,
          name: '聯(lián)盟廣告'
        },
        {
          value: 135,
          name: '視頻廣告'
        },
        {
          value: 1548,
          name: '搜索引擎'
        }
      ]
    },
    {
      name: 'radial gradient',
      type: 'pie',
      radius: '70%',
      avoidLabelOverlap: false,
      itemStyle: {
        normal: {
          color: {
            type: 'radial',
            x: 0.5,
            y: 0.5,
            r: 0.5,
            colorStops: [{
              offset: 0,
              color: 'rgba(255,255,255,0)'
            }, {
              offset: 0.55,
              color: 'rgba(255,255,255,0.5)'
            }, {
              offset: 0.65,
              color: 'rgba(255,255,255,0.5)'
            }, {
              offset: 0.95,
              color: 'rgba(255,255,255,0)'
            }],
            globalCoord: false
          }
        }
      },
      silent: true,
      z: 999,
    }
  ]
};


// 使用剛指定的配置項(xiàng)和數(shù)據(jù)顯示圖表。
myChart.setOption(option);

</script>
</body>

</html>

回答
編輯回答
離魂曲
var index = 0;//數(shù)據(jù)的第幾個(gè)顯示
//高亮圖形
myChart.dispatchAction({
  type: 'highlight',
  seriesIndex: 0,
  dataIndex: index 
});
// 顯示 tooltip
myChart.dispatchAction({
  type: 'showTip',
  seriesIndex: 0,
  dataIndex: index 
});        
2018年7月22日 23:27