Javascript Highcharts pie chart Display number and Percent instance code _javascript tips

Source: Internet
Author: User

Javascript Highcharts pie chart showing quantity and percent instance code

Recently, the company project needs to have such a functional module, Highcharts pie chart showing the number and percentage, because I just get started, see this demand will not write, so on the Internet to search the relevant information, think a good record.

<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: ' Version distribution Analysis '}, PlotArea: {shadow:null, Borderwidth:null, backgroundcolor:null}, tooltip : {formatter:function () {return ' <b> ' + this.point.name + ' </b>: ' + Highcharts.numberformat (THIS.P
     Ercentage, 1) + '% (' + highcharts.numberformat (this.y, 0, ', ') + ') '; }, Plotoptions: {pie: {allowpointselect:true, cursor: ' pointer ', DataLabels: {E
        Nabled: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], [' New contrast ', 5000]]}];
});
 </script>

Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.