Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div ng-app="myApp">
  <div class="hc-pie" items="limitedIdeas"></div>
  <!-- <div ng-controller="MyCtrl">
    </div> --></div>
<!-- <div id="container" style="height: 400px; min-width: 310px"></div> -->
              
            
!

CSS

              
                
              
            
!

JS

              
                /* highcharts + angularjs + live random data example */

function MyCtrl($scope, limitToFilter) {
  $scope.ideas = [
    ['ideas1', 1],
    ['ideas2', 8],
    ['ideas3', 5]
  ];

  $scope.limitedIdeas = limitToFilter($scope.ideas, 2);
}

angular.module('myApp', [])
  .directive('hcPie', function() {
    return {
      restrict: 'C',
      replace: true,
      scope: {
        items: '='
      },
      controller: function($scope, $element, $attrs) {
        console.log(2);

      },
      template: '<div id="container" style="margin: 0 auto">not working</div>',
      link: function(scope, element, attrs) {
          console.log(3);

          Highcharts.setOptions({
            global: {
              useUTC: false
            }
          });

          var chart;
          var chartOptions = {
            chart: {
              renderTo: 'container',
              events: {
                load: function() {
                  // set up the updating of the chart each second
                  console.log('this=', this);
                  //console.log('chart=',chart);
                  var series = this.series[0];
                  setInterval(function() {
                    console.log('interval');
                    var x = (new Date()).getTime(), // current time
                      y = Math.round(Math.random() * 100);
                    console.log('y=', y);
                    series.addPoint([x, y], true, true);
                  }, 1000);
                }
              }
            },

            rangeSelector: {
              buttons: [{
                count: 1,
                type: 'minute',
                text: '1M'
              }, {
                count: 5,
                type: 'minute',
                text: '5M'
              }, {
                type: 'all',
                text: 'All'
              }],
              inputEnabled: false,
              selected: 0
            },

            title: {
              text: 'Live random data'
            },

            exporting: {
              enabled: false
            },

            series: [{
              name: 'Random data',
              data: (function() {
                // generate an array of random data
                var data = [],
                  time = (new Date()).getTime(),
                  i;

                for (i = -999; i <= 0; i += 1) {
                  var x = time + i * 1000,
                    y = Math.round(Math.random() * 100);
                  data.push([x, y]);
                  console.log('y=', y);
                }
                return data;
              }())
            }]
          };

          chart = new Highcharts.StockChart(chartOptions);

          /*
      var chart = new Highcharts.Chart({
        chart: {
          renderTo: 'container',
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false
        },
        title: {
          text: 'Browser market shares at a specific website, 2010'
        },
        tooltip: {
          pointFormat: '{series.name}: <b>{point.percentage}%</b>',
          percentageDecimals: 1
        },
        plotOptions: {
          pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
              enabled: true,
              color: '#000000',
              connectorColor: '#000000',
              formatter: function () {
                return '<b>' + this.point.name + '</b>: ' + this.percentage + ' %';
              }
            }
          }
        },
        series: [{
          type: 'pie',
          name: 'Browser share',
          data: scope.items
        }]
      });
      */
          /*
            scope.$watch("items", function (newValue) {
                chart.series[0].setData(newValue, true);
            }, true);
*/

        } // link

    }; // return 

  }); // angular.module('myApp', []).directive()

/*
$(function () {

    Highcharts.setOptions({
        global : {
            useUTC : false
        }
    });

    // Create the chart
    $('#container').highcharts('StockChart', {
        chart : {
            events : {
                load : function () {

                    // set up the updating of the chart each second
                    var series = this.series[0];
                    setInterval(function () {
                        var x = (new Date()).getTime(), // current time
                            y = Math.round(Math.random() * 100);
                        series.addPoint([x, y], true, true);
                    }, 1000);
                }
            }
        },

        rangeSelector: {
            buttons: [{
                count: 1,
                type: 'minute',
                text: '1M'
            }, {
                count: 5,
                type: 'minute',
                text: '5M'
            }, {
                type: 'all',
                text: 'All'
            }],
            inputEnabled: false,
            selected: 0
        },

        title : {
            text : 'Live random data'
        },

        exporting: {
            enabled: false
        },

        series : [{
            name : 'Random data',
            data : (function () {
                // generate an array of random data
                var data = [], time = (new Date()).getTime(), i;

                for (i = -999; i <= 0; i += 1) {
                    data.push([
                        time + i * 1000,
                        Math.round(Math.random() * 100)
                    ]);
                }
                return data;
            }())
        }]
    });

});
*/
              
            
!
999px

Console