jQuery & highcharts

本文展示了一个使用jQuery和Highcharts库创建的饼图示例,该图表显示了不同代码问题类型的分布情况。通过允许点选择及鼠标悬停提示等功能增强用户体验。

jQuery, highcharts,

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js


<script type="text/javascript">
data4 =[[ ' UNREACH.GEN ' , 35.9 ] , [ ' ABR ' , 33.2 ] , [ ' NPD.FUNC.MUST ' , 6.2 ] , [ ' SV.FMT_STR.PRINT_FORMAT_MISMATCH.UNDESIRED ' , 5.1 ] , [ ' UNINIT.STACK.MIGHT ' , 3.1 ] , [ ' NPD.FUNC.MIGHT ' , 2.6 ] , [ ' NPD.CHECK.MIGHT ' , 1.8 ] , [ ' RH.LEAK ' , 1.2 ] , [ ' UNINIT.STACK.MUST ' , 1 ] , [ ' LOCRET.ARG ' , 1 ] , [ ' Others ' , 8.8 ]]

var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'codespiechart'
      },
      title: {
         text: 'Top 10 Codes'
      },
      plotArea: {
         shadow: null,
         borderWidth: null,
         backgroundColor: null
      },
      tooltip: {
         formatter: function() {
            return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
         }
      },
      plotOptions: {
         pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
            enabled: true,
                color: '#FFFFFF',
                connectorColor: '#BDBDBD',
                formatter: function() {
                    return '<b>'+ this.point.name +'</b>: '+ this.y +' %';
                    }
             }
         }
      },
       series: [{
         type: 'pie',
         name: 'codespiechart',
         data: data4
      }]
   });
});
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值