首页 >web前端 >js教程 >HighCharts绘制2D带有Legend的饼图效果实例分享

HighCharts绘制2D带有Legend的饼图效果实例分享

小云云
小云云原创
2018-01-22 16:54:061741浏览

本文主要介绍了jQuery插件HighCharts绘制2D带有Legend的饼图效果,结合实例形式分析了jQuery使用HighCharts绘制带明细显示的饼状图效果实现技巧,并附带了demo源码供读者下载参考,需要的朋友可以参考下,希望能帮助到大家。

本文实例讲述了jQuery插件HighCharts绘制2D带有Legend的饼图效果。分享给大家供大家参考,具体如下:

1、实例代码:


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HighCharts 2D带有Legend的饼图</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/highcharts.js"></script>
<script type="text/javascript">
   $(function(){
    // 构建饼图
     $(&#39;#pieChart&#39;).highcharts({
       chart: {
         plotBackgroundColor: &#39;#384778&#39;,
         plotBorderWidth: &#39;50px&#39;,
         plotShadow: true
       },
       title: {
         text: &#39;(jb51.net)2013年4月日收入明细&#39;
       },
       tooltip: {
        pointFormat: &#39;{series.name}: <b>{point.percentage:.1f}%</b>&#39;
       },
       plotOptions: {
         pie: {
           allowPointSelect: true,
           cursor: &#39;pointer&#39;,
           dataLabels: {
             enabled: true
           },
           showInLegend: true
         }
       },
       series: [{
         type: &#39;pie&#39;,
         name: &#39;日收入比率&#39;,
         data: [
           [&#39;20130401&#39;, 45.0],
           [&#39;20130402&#39;, 26.8],
           [&#39;20130403&#39;, 56.3],
           [&#39;20130404&#39;, 74.1],
           [&#39;20130405&#39;, 45.0],
           [&#39;20130406&#39;, 26.8],
           [&#39;20130407&#39;, 56.4],
           [&#39;20130408&#39;, 84.1],
           [&#39;20130409&#39;, 55.0],
           [&#39;20130410&#39;, 56.8],
           [&#39;20130411&#39;, 64.8],
           [&#39;20130412&#39;, 63.2],
           [&#39;20130413&#39;, 64.8],
           [&#39;20130414&#39;, 63.2],
           [&#39;20130415&#39;, 64.8],
           [&#39;20130416&#39;, 45.2],
           [&#39;20130417&#39;, 68.8],
           [&#39;20130418&#39;, 63.2],
           [&#39;20130419&#39;, 24.8],
           [&#39;20130420&#39;, 53.2],
           {
             name: &#39;20130421&#39;,
             y: 27.8,
             sliced: true,
             selected: true
           },
           [&#39;20130422&#39;, 63.2],
           [&#39;20130423&#39;, 64.8],
           [&#39;20130424&#39;, 63.2],
           [&#39;20130425&#39;, 64.8],
           [&#39;20130426&#39;, 45.2],
           [&#39;20130427&#39;, 68.8],
           [&#39;20130428&#39;, 63.2],
           [&#39;20130429&#39;, 24.8],
           [&#39;20130430&#39;, 98.8]
         ]
       }]
     });
   });
</script>
</head>
<body>
  <p id="pieChart" style="width: 1250px; height: 500px; margin: 0 auto"></p>
</body>
</html>

2、运行效果图:

相关推荐:

jQuery插件HighCharts绘制2D饼图效果实例分享

highcharts用法的实例代码

PHP+mysql+Highcharts实现饼状统计图_PHP教程


以上是HighCharts绘制2D带有Legend的饼图效果实例分享的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn