Highcharts 是一個用純JavaScript寫的一個圖表庫。

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

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

Highcharts 基本圓餅圖 語法

HighCharts 特性

相容性?- 支援所有主流瀏覽器和行動平臺(android、iOS等)。

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

免費使用?- 開源免費。

輕量?- highcharts.js 核心庫大小只有 35KB 左右。

設(shè)定簡單?- 使用 json 格式設(shè)定

動態(tài)?- 可以在圖表產(chǎn)生後修改。

多維?- 支援多維圖表

設(shè)定提示工具?- 滑鼠移動到圖表的某一點上有提示訊息。

時間軸?- 可以精確到毫秒。

匯出?- 表格可匯出為 PDF/ PNG/ JPG / SVG 格式

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

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

外部資料?- 從伺服器載入動態(tài)資料。

文字旋轉(zhuǎn)?- 支援在任何方向的標籤旋轉(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 年各瀏覽器市場占有比例'   
   };      
   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>

執(zhí)行實例 ?

點擊 "執(zhí)行實例" 按鈕查看線上實例