SHARE
TWEET
Untitled
a guest
Dec 19th, 2014
4
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- var mainApp = angular.module('mainApp', ['n3-line-chart']);
- mainApp.controller('MainController', function ($scope) {
- $scope.state = {"time": 1.234, "pressure": -29348}
- $scope.data = [
- {x: 0, value: 4, otherValue: 14},
- {x: 1, value: 8, otherValue: 1},
- {x: 2, value: 15, otherValue: 11},
- {x: 3, value: 16, otherValue: 147},
- {x: 4, value: 23, otherValue: 87},
- {x: 5, value: 42, otherValue: 45}
- ];
- last_x = 5
- last_v = 42
- $scope.options = {
- axes: {
- x: {key: 'x', labelFunction: function(value) {return value;}, type: 'linear', min: 0, max: 5, ticks: 2},
- y: {type: 'linear', min: 0, max: 50, ticks: 5},
- // y2: {type: 'linear', min: 0, max: 1, ticks: [1, 2, 3, 4]}
- },
- series: [
- {y: 'value', color: 'steelblue', thickness: '2px', type: 'line', striped: true, label: 'Pouet'},
- // {y: 'otherValue', axis: 'y2', color: 'lightsteelblue', visible: false, drawDots: true, dotSize: 2}
- ],
- lineMode: 'linear',
- tension: 0.7,
- tooltip: {mode: 'scrubber', formatter: function(x, y, series) {return 'pouet';}},
- drawLegend: true,
- drawDots: true,
- columnsHGap: 5
- }
- $scope.$watch('data',
- function(newValue, oldValue) {
- console.log('changed detected!', newValue, oldValue)
- }
- );
- $scope.addData = function() {
- last_x += 1
- last_v += 5
- $scope.data.push({x: last_x, y: last_v})
- // console.log($scope.data)
- }
- });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

