Highcharts圖表AngularJS指令擴展:Highcharts-ng

dcb3 9年前發布 | 91K 次閱讀 圖表/報表制作 Highcharts-ng

Highcharts-ng 是一個將Highcharts 圖表庫集成至AngularJS應用中的AngularJS 指令擴展。

特性:

  • Adding and removing series
  • Setting/Updating Chart options
  • Updating the chart title
  • 2 way binding to chart xAxis
  • Control of Loading status
  • Resizes with screen size changes.
  • </ul>

    Highcharts圖表AngularJS指令擴展:Highcharts-ng

    演示地址:http://jsfiddle.net/pablojim/46rhz/

    使用方法:

    var myapp = angular.module('myapp', ["highcharts-ng"]);

    HTML:

    <highchart id="chart1" config="chartConfig"></highchart>

    chartConfig:

    //This is not a highcharts object. It just looks a little like one!
    var chartConfig = {
    
      options: {
          //This is the Main Highcharts chart config. Any Highchart options are valid here.
          //will be overriden by values specified below.
          chart: {
              type: 'bar'
          },
          tooltip: {
              style: {
                  padding: 10,
                  fontWeight: 'bold'
              }
          }
      },
      //The below properties are watched separately for changes.
    
      //Series object (optional) - a list of series using normal highcharts series options.
      series: [{
         data: [10, 15, 12, 8, 7]
      }],
      //Title configuration (optional)
      title: {
         text: 'Hello'
      },
      //Boolean to control showng loading status on chart (optional)
      //Could be a string if you want to show specific loading text.
      loading: false,
      //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled.
      //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum
      xAxis: {
      currentMin: 0,
      currentMax: 20,
      title: {text: 'values'}
      },
      //Whether to use HighStocks instead of HighCharts (optional). Defaults to false.
      useHighStocks: false,
      //size (optional) if left out the chart will default to size of the div or something sensible.
      size: {
       width: 400,
       height: 300
      },
      //function (optional)
      func: function (chart) {
       //setup some logic for the chart
      }
    };

    項目主頁:http://www.baiduhome.net/lib/view/home/1432082915333

 本文由用戶 dcb3 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!