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>
Highcharts饼图的配置项包括以下内容: 1. `legend`:图例的设置,可以控制图例的显示、布局、背景颜色等。 2. `plotOptions`:绘图选项,可以设置饼图的大小、内圈直径等。 3. `tooltip`:提示框的设置,可以定义提示框的格式。 4. `chart`:图表的设置,包括类型、背景颜色、边距等。 5. `title`:标题的设置。 6. `series`:数据列的设置,可以定义饼图的数据以及数据标签的样式。 这些配置项可以通过Javascript对象的方式进行设置,例如: ``` let option = { chart: { type: "pie", backgroundColor: "rgba(0, 0, 0, 0)", marginTop:10, options3d: { enabled: true, alpha: 50, beta: 0, }, }, title: { text: "", }, plotOptions: { pie: { borderColor: "#000", borderWidth: 1, allowPointSelect: true, cursor: "pointer", depth: 24, dataLabels: { enabled: true, format: "{point.name}", style: { textOutline: "none", color: "rgba(45,153,255,1)", fontSize: 11, }, }, }, }, series: [ { type: "pie", data: [ ["邮政包裹", 30], ["圆通快递", 20], ["京东快递", 30], ["申通快递", 50], ["德邦物流", 20], ["天天快递", 20], ["其他", 30], ["顺丰快递", 10], ["中通快递", 30], ["韵达快递", 20], ], }, ], }; Highcharts.chart("DispatchProportion", option); ``` 以上就是绘制Highcharts饼图所需的配置项。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Highcharts 3D饼图(1)上手使用配置](https://blog.csdn.net/kkk_xxx/article/details/109380972)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [highcharts 饼图常用设置项](https://blog.csdn.net/qq_26769677/article/details/80229195)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值