[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",
"implementation": "directives/MCTChart.js",
"depends": [ "$interval", "$log" ]
"depends": [ "$interval", "$log", "agentService" ]
},
{
"key": "mctPlot",
@ -58,7 +58,7 @@
{
"key": "PlotController",
"implementation": "controllers/PlotController.js",
"depends": [ "$scope", "colorService"]
"depends": [ "$scope", "colorService", "agentService"]
},
{
"key": "StackedPlotController",

View File

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

View File

@ -35,7 +35,7 @@ define(
*
* @constructor
*/
function MCTChart($interval) {
function MCTChart($interval, $log, agentService) {
function linkChart($scope, $element) {
var canvas = $element.find("canvas")[0],
@ -199,8 +199,13 @@ define(
}
}
// Check for resize, on a timer
activeInterval = $interval(drawIfResized, 1000);
// Check for resize, on a timer, the timer is 15
// 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);
redraw();