饼状图详细配置

  var chart;
function lo(data) {
chart = new Highcharts.Chart({
chart: {
renderTo: 'pie1', //饼状图关联html元素id值
defaultSeriesType: 'pie', //默认图表类型为饼状图
plotBackgroundColor: '#FFFFFF', //设置图表区背景色
plotShadow: true //设置阴影
},
title: {
text: '织带类别' //图表标题
},
credits: {
text: ''
},
tooltip: {
formatter: function() { //鼠标滑向图像提示框的格式化提示信息
return '<b>' + this.point.name + '</b>: ' + this.y;
}
},
plotOptions: {
pie: {
allowPointSelect: true, //允许选中,点击选中的扇形区可以分离出来显示
cursor: 'pointer', //当鼠标指向扇形区时变为手型(可点击)
showInLegend: true, //如果要显示图例,可将该项设置为true
events: {
click: function (e) {
alert(e.point.name);
}
},
dataLabels: {
enabled: true, //设置数据标签可见,即显示每个扇形区对应的数据
color: '#000000', //数据显示颜色
connectorColor: '#999', //设置数据域扇形区的连接线的颜色
style:{
fontSize: '12px' //数据显示的大小
},
formatter: function() { //格式化数据
return '<b>' + this.point.name + '</b>: ' + this.percentage + ' %';
//return '<b>' + this.point.name + '</b>: ' + this.y ;
},

}
}
},
series: [{ //数据列
name: 'search engine',
data: data,//核心数据列来源于php读取的数据并解析成JSON
animation: true
}]
});
}
posted @ 2018-09-08 11:26  LanXiny  阅读(238)  评论(0编辑  收藏  举报