highcharts 饼图显示数量和百分比

<div class="piecleft" id="chart" style="height:350px; width: 350px;">
</div>
<script type="text/javascript" charset="utf-8">

var  chart;
$(document).ready(
function () {
   chart 
=   new  Highcharts.Chart({
      chart: {
         renderTo: 
' chart '
      },
      title: {
         text: 
' 版本分布分析 '
      },
      plotArea: {
         shadow: 
null ,
         borderWidth: 
null ,
         backgroundColor: 
null
      },
      tooltip: {
         formatter: 
function () {
            
return   ' <b> ' +   this .point.name  + ' </b>:  ' +  Highcharts.numberFormat( this .percentage,  1 + ' ( ' +
                         Highcharts.numberFormat(
this .y,  0 ' , ' + '  个) ' ;
         }
      },
      plotOptions: {
         pie: {
            allowPointSelect: 
true ,
            cursor: 
' pointer ' ,
            dataLabels: {
               enabled: 
true ,
               formatter: 
function () {
                  
if  ( this .percentage  >   4 return   this .point.name;
               },
               color: 
' white ' ,
               style: {
                  font: 
' 13px Trebuchet MS, Verdana, sans-serif '
               }
            }
         }
      },
      legend: {
         backgroundColor: 
' #FFFFFF ' ,
         x: 
0 ,
         y: 
- 30
      },
      credits: {
          enabled: 
false
      },
       series: [{
         type: 
' pie ' ,
         name: 
' Browser share ' ,
         data: [
            [
' 1.1 ' , 3617 ],
            [
' 1.2.1 ' , 3436 ],
            [
' 1.0 ' , 416 ],
            [
' 1.3 ' , 2 ],
            [
' 1.2 ' , 1 ],
            [
' 新增对比 ' , 5000
         ]
      }]
   });
});
</script>
  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值