[Mobile] Gestures

Redraw rate adjusted to redraw on
mobile every 15ms instead of 1000ms
(like on desktop). Also added agentservice
to PlotController and MCTChart (bundles and

file.
This commit is contained in:
Shivam Dave 2015-09-03 11:47:33 -07:00
parent db1b76413c
commit c394151c46
3 changed files with 11 additions and 6 deletions

View File

@ -35,7 +35,7 @@
{ {
"key": "mctChart", "key": "mctChart",
"implementation": "directives/MCTChart.js", "implementation": "directives/MCTChart.js",
"depends": [ "$interval", "$log" ] "depends": [ "$interval", "$log", "agentService" ]
}, },
{ {
"key": "mctPlot", "key": "mctPlot",
@ -58,7 +58,7 @@
{ {
"key": "PlotController", "key": "PlotController",
"implementation": "controllers/PlotController.js", "implementation": "controllers/PlotController.js",
"depends": [ "$scope", "colorService"] "depends": [ "$scope", "colorService", "agentService"]
}, },
{ {
"key": "StackedPlotController", "key": "StackedPlotController",

View File

@ -9,7 +9,7 @@ define(
// domainObject metadata. // domainObject metadata.
var DOMAIN_INTERVAL = 2 * 60 * 1000; // Two minutes. var DOMAIN_INTERVAL = 2 * 60 * 1000; // Two minutes.
function PlotController($scope, colorService) { function PlotController($scope, colorService, agentService) {
var plotHistory = [], var plotHistory = [],
isLive = true, isLive = true,
maxDomain = +new Date(), maxDomain = +new Date(),

View File

@ -35,7 +35,7 @@ define(
* *
* @constructor * @constructor
*/ */
function MCTChart($interval) { function MCTChart($interval, $log, agentService) {
function linkChart($scope, $element) { function linkChart($scope, $element) {
var canvas = $element.find("canvas")[0], var canvas = $element.find("canvas")[0],
@ -199,8 +199,13 @@ define(
} }
} }
// Check for resize, on a timer // Check for resize, on a timer, the timer is 15
activeInterval = $interval(drawIfResized, 1000); // on mobile (to allow quick refresh of drawing).
if(agentService.isMobile(navigator.userAgent)) {
activeInterval = $interval(drawIfResized, 15, false);
} else {
activeInterval = $interval(drawIfResized, 1000, false);
}
$scope.$on('series:data:add', onSeriesDataAdd); $scope.$on('series:data:add', onSeriesDataAdd);
redraw(); redraw();