hightchart饼状图图例、内容放置在饼上
2017-08-15 09:54
555 查看
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: null
},
legend: {
layout: 'vertical',
align: 'left', //水平方向位置
horizontalAlign:'center',
labelFormatter: function () {
return this.name + ':'+this.percentage+'%';
}
},
tooltip: {
headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 30,
dataLabels: {
enabled: true,
color:'black',
connectorWidth:0,
connectorPadding:0,
distance:-30,formatter:function(){
return '<b>'+this.point.name+'</b>:'+this.point.percentage.toFixed(2)+"%";
},
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '浏览器访问量占比',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['其他', 0.7]
]
}]
});
});
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: null
},
legend: {
layout: 'vertical',
align: 'left', //水平方向位置
horizontalAlign:'center',
labelFormatter: function () {
return this.name + ':'+this.percentage+'%';
}
},
tooltip: {
headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
depth: 30,
dataLabels: {
enabled: true,
color:'black',
connectorWidth:0,
connectorPadding:0,
distance:-30,formatter:function(){
return '<b>'+this.point.name+'</b>:'+this.point.percentage.toFixed(2)+"%";
},
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: '浏览器访问量占比',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['其他', 0.7]
]
}]
});
});
相关文章推荐
- MPAndroidChart开源图表库之饼状图
- HightChart颜色
- 【HTML】把两个div的内容放置在同一行
- chart 图例点击事件
- PHP中使用GOOGCHART类进行饼状图、走势图数据统计
- JQuery+ HightChart+Ajax
- HightChart数据提示框(Tooltip)
- 在窗体上放置saveFileDialog、openFileDialog两个控件。实现功能:1)程序运行时,在文本框(注意文本框多行、带垂直滚动条)中输入汉字、字符等,单击保存按钮,即可将文本框中内容保
- Linux目录配置及应放置的内容
- 怎样用XMind将主题内容放置在线上?
- hellocharts-android图表库之饼状图:PieChartView
- HightChart实现二维数组
- HightChart版权信息(credits)
- HightChart 图表时间轴显示不全
- chart.js增加图例
- Hightchart 技巧
- MPAndroidChart项目实战(三)——饼状图实现和文字重合问题解决
- linux下各个目录下放置的内容
- MPAndroidChart开源图表库之饼状图