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!