幽灵资源网 Design By www.bzswh.com

Javascript highcharts 饼图显示数量和百分比实例代码

                  最近公司项目需求有这样一个功能模块,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>

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

标签:
Javascript,highcharts,饼图显示数量和百分比,JS,饼图显示数量和百分比开发实例

幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。