Highcharts 是一個(gè)用純JavaScript編寫的一個(gè)圖表庫(kù)。

Highcharts 能夠很簡(jiǎn)單便捷的在web網(wǎng)站或是web應(yīng)用程序添加有交互性的圖表

Highcharts 免費(fèi)提供給個(gè)人學(xué)習(xí)、個(gè)人網(wǎng)站和非商業(yè)用途使用。

Highcharts 基本餅圖 語(yǔ)法

HighCharts 特性

兼容性?- 支持所有主流瀏覽器和移動(dòng)平臺(tái)(android、iOS等)。

多設(shè)備?- 支持多種設(shè)備,如手持設(shè)備 iPhone/iPad、平板等。

免費(fèi)使用?- 開源免費(fèi)。

輕量?- highcharts.js 內(nèi)核庫(kù)大小只有 35KB 左右。

配置簡(jiǎn)單?- 使用 json 格式配置

動(dòng)態(tài)?- 可以在圖表生成后修改。

多維?- 支持多維圖表

配置提示工具?- 鼠標(biāo)移動(dòng)到圖表的某一點(diǎn)上有提示信息。

時(shí)間軸?- 可以精確到毫秒。

導(dǎo)出?- 表格可導(dǎo)出為 PDF/ PNG/ JPG / SVG 格式

輸出?- 網(wǎng)頁(yè)輸出圖表。

可變焦?- 選中圖表部分放大,近距離觀察圖表;

外部數(shù)據(jù)?- 從服務(wù)器載入動(dòng)態(tài)數(shù)據(jù)。

文字旋轉(zhuǎn)?- 支持在任意方向的標(biāo)簽旋轉(zhuǎn)。

Highcharts 基本餅圖 示例

<html>
<head>
<meta charset="UTF-8" />
<title>Highcharts 教程 | php.cn</title>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {  
   var chart = {
       plotBackgroundColor: null,
       plotBorderWidth: null,
       plotShadow: false
   };
   var title = {
      text: '2014 年各瀏覽器市場(chǎng)占有比例'   
   };      
   var tooltip = {
      pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
   };
   var plotOptions = {
      pie: {
         allowPointSelect: true,
         cursor: 'pointer',
         dataLabels: {
            enabled: true,
            format: '<b>{point.name}%</b>: {point.percentage:.1f} %',
            style: {
               color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
            }
         }
      }
   };
   var series= [{
      type: 'pie',
      name: 'Browser share',
      data: [
         ['Firefox',   45.0],
         ['IE',       26.8],
         {
            name: 'Chrome',
            y: 12.8,
            sliced: true,
            selected: true
         },
         ['Safari',    8.5],
         ['Opera',     6.2],
         ['Others',   0.7]
      ]
   }];     
      
   var json = {};   
   json.chart = chart; 
   json.title = title;     
   json.tooltip = tooltip;  
   json.series = series;
   json.plotOptions = plotOptions;
   $('#container').highcharts(json);  
});
</script>
</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例