Created
August 20, 2017 17:51
-
-
Save leandrocosta/67c6c3c5d0b06b20962ceee093d62145 to your computer and use it in GitHub Desktop.
Revisions
-
leandrocosta created this gist
Aug 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ <!doctype html> <html ng-app="app"> <head> <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.12/d3.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/line-chart/1.1.12/line-chart.min.js"></script> <script type="text/javascript"> var app = angular.module('app', ['n3-line-chart']); app.controller('MainCtrl', function($scope, $http) { $http.get('data.json').success(function(response) { $scope.setup = response; response.tracks.forEach(function(t) { if (t.series) { t.series.forEach(function(s) { s.data.forEach(function(sample) { if (!(sample.x instanceof Date)) { sample.x = new Date(sample._xDateTime); } }); }); arrays = t.series.map(function(s){ return s.data; }); t.data = [].concat.apply([], arrays); } else { t.data = []; } }); $scope.tracks = response.tracks; }); $scope.options = { axes: { x: { type: 'date', zoomable: true, }, y: {}, y2: { ticks: 1, min: 0, max: 1, } }, series: [ { y: 'input', axis: 'y', type: 'area', label: 'Temperature', color: '#d62728', }, { y: 'outputSSR', type: 'area', axis: 'y2', label: 'SSR Output', color: '#ff7f0e', } ], drawDots: false }; }); </script> </head> <body ng-controller='MainCtrl'> <p>{{setup.name}} ({{setup.dateTime | date:'dd/MM/yyyy'}})</p> <linechart ng-repeat="track in tracks" data="track.data" options="options" mode="" height="300"></linechart> </body> </html>