cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <html ng-app="app">
  <body ng-controller="DashboardController">
    <div class="container" id="dashboard">
      <div class="row">
        <!-- side column -->
        <div kendo-sortable class="col-sm-4 placeholder" id="side"
             k-connect-with="'#main'" 
             k-placeholder="placeholder" 
             k-hint="hint" 
             k-filter="'.widget'" 
             k-on-change="dropped(kendoEvent)">
          <div class="widget">  
            <ul kendo-panel-bar>
              <li class="k-state-active">
                <span class="k-link k-state-selected">Account</span>
                <div class="widget-centered">
                  <img class="img-responsive" src="https://i.imgur.com/6wGCVmv.jpg">
                </div>
                <div>
                  <p><strong>Bob Johnson</strong></p>
                  <p>Junior Vice President<p>
                </div>
              </li>
            </ul>
          </div>
          <div class="widget">
            <ul kendo-panel-bar>
              <li class="k-state-active">
                <span class="k-link k-state-selected">Bitcoin</span>
                <div class="widget-centered bitcoin">
                  <span>{{bitcoinLast[0].value | currency}}</span>
                </div>
              </li>
            </ul>
          </div>
          <!-- end side column -->
        </div>
        <!-- main column -->
        <div kendo-sortable id="main" class="col-sm-8 placeholder" 
             k-connect-with="'#side'" 
             k-placeholder="placeholder"
             k-hint="hint" 
             k-filter="'.widget'" 
             k-on-change="dropped(kendoEvent)">
          <div class="widget">
            <ul kendo-panel-bar>
              <li class="k-state-active">
                <span class="k-link k-state-selected">Portfolio</span>
                <div>
                  <kendo-grid sortable="true" data-source="cryptocurrencyDataSource" columns="[ { title: 'Currency', field: 'id' }, { attributes: { 'class': 'spark' }, field: 'ask', template: sparklineLastTemplate, title: 'Last' }, { attributes: { 'class': 'spark' }, field: 'bid', template: sparklineBidTemplate, title: 'Bid' }]" theme="'bootstrap'" />
                </div>
              </li>
            </ul>
          </div>
          <!-- end main column -->
        </div>
        <!-- end row -->
      </div>
      <!-- end container -->
    </div>
    <script id="sparklineAskTemplate" type="text/x-kendo-template">
      <span style="float: left;">{{#: id #Ask[0].value}}</span>
      <span style="float: right;">
        <kendo-sparkline chart-area="{ background: 'transparent', width: 50 }" data-source="#: id + 'Ask' #" series="[{ field: 'value', type: 'line' }]" series-defaults="{ line: { width: 2 }, markers: { visible: false } }" theme="'bootstrap'" />
      </span>
    </script>
    <script id="sparklineBidTemplate" type="text/x-kendo-template">
      <span style="float: left;">{{#: id #Bid[0].value}}</span>
      <span style="float: right;">
        <kendo-sparkline chart-area="{ background: 'transparent', width: 50 }" data-source="#: id + 'Bid' #" series="[{ field: 'value', type: 'line' }]" series-defaults="{ line: { width: 2 }, markers: { visible: false } }" theme="'bootstrap'" />
      </span>
    </script>
    <script id="sparklineLastTemplate" type="text/x-kendo-template">
      <span style="float: left;">{{#: id #Last[0].value}}</span>
      <span style="float: right;">
        <kendo-sparkline chart-area="{ background: 'transparent', width: 50 }" data-source="#: id + 'Last' #" series="[{ field: 'value', type: 'line' }]" series-defaults="{ line: { width: 2 }, markers: { visible: false } }" theme="'bootstrap'" />
      </span>
    </script>
  </body>
</html>
            
          
!
            
              html, body {
  height: 100%;
  width: 100%;
}

.widget {
  margin-bottom: 10px;
}

.widget .k-panelbar .k-content {
  padding: 10px;
}

.widget.placeholder {
  opacity: 0.4;
  border: 1px dashed #a6a6a6;
}

.widget-centered > * {
  margin: auto;
}

.spark {
  vertical-align: center;
}

.bitcoin {
  font-size: 2em;
  font-weight: bold;
}
            
          
!
            
              (function ($, kendo, angular) {

  'use strict';

  var app = angular.module('app', ['kendo.directives']);

  app.controller('DashboardController', function ($scope) {

    var onChange = function (e) {
      e.items.forEach(function (element, index, array) {
        $scope[element.id + "Ask"].unshift({ value: parseFloat(element.ask) });
        $scope[element.id + "Bid"].unshift({ value: parseFloat(element.bid) });
        $scope[element.id + "Last"].unshift({ value: parseFloat(element.last) });
        if ($scope[element.id + "Ask"].length > 50) {
          $scope[element.id + "Ask"].pop();
        }
        if ($scope[element.id + "Bid"].length > 50) {
          $scope[element.id + "Bid"].pop();
        }
        if ($scope[element.id + "Last"].length > 50) {
          $scope[element.id + "Last"].pop();
        }
      });
    };

    $scope.bitcoinAsk = [];
    $scope.bitcoinBid = [];
    $scope.bitcoinLast = [];
    $scope.dogecoinAsk = [];
    $scope.dogecoinBid = [];
    $scope.dogecoinLast = [];
    $scope.litecoinAsk = [];
    $scope.litecoinBid = [];
    $scope.litecoinLast = [];
    $scope.sparklineAskTemplate = kendo.template($('#sparklineAskTemplate').html());
    $scope.sparklineBidTemplate = kendo.template($('#sparklineBidTemplate').html());
    $scope.sparklineLastTemplate = kendo.template($('#sparklineLastTemplate').html());

    $scope.placeholder = function (element) {
      return element.clone().addClass("placeholder");
    };

    $scope.hint = function (element) {
      return element.clone().addClass("hint")
      .height(element.height())
      .width(element.width());
    };

    $scope.cryptocurrencyDataSource = new kendo.data.DataSource({
      autoSync: true,
      change: onChange,
      schema: {
        model: {
          id: "id"
        }
      },
      transport: {
        firebase: {
          url: "https://publicdata-cryptocurrency.firebaseio.com/"
        }
      },
      type: "firebase"
    });

    // when an item is dropped in either the side or
    // main containers, resize any Kendo UI widgets
    // inside
    $scope.dropped = function (e) {
      if (e.action === 'receive') {
        kendo.resize(e.item);
      }
    };

  });

}(window.jQuery, window.kendo, window.angular));
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console