这个是鼠标移进去的效果,但是我想打开页面的时候,就有一个默认为这样的!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="echarts.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="width: 335px;height:325px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
tooltip: {
trigger: 'item'
},
series: [{
name: '学校录取信息',
type: 'pie',
radius: ['45%', '70%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
emphasis: {
show: true,
textStyle: {
fontSize: '14',
fontWeight: 'bold'
}
}
},
labelLine: {
normal: {
show: true
}
},
data: [{
value: 335,
name: '直接访问'
},
{
value: 310,
name: '邮件营销'
},
{
value: 234,
name: '联盟广告'
},
{
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,
}
]
};
var index = 0;//数据的第几个显示
//高亮图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: index
});
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: index
});
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
</body>
</html>
通过 highlight 指定高亮:http://echarts.baidu.com/api....