climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1501017 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js
Date Mon, 08 Jul 2013 23:42:23 GMT
Author: joyce
Date: Mon Jul  8 23:42:22 2013
New Revision: 1501017

URL: http://svn.apache.org/r1501017
Log:
CLIMATE-178 - Make changes to TimelineCtrl indentation.

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js?rev=1501017&r1=1501016&r2=1501017&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js Mon Jul 
8 23:42:22 2013
@@ -28,68 +28,65 @@ function($rootScope, $scope, selectedDat
  		}
 
 		// Don't process if no datasets have been added
-		if ($scope.datasets.length == 0)
+		if ($scope.datasets.length == 0 || !("timeline" in $rootScope))
 			return;
  		
- 		if ("timeline" in $rootScope) {
- 			
- 			// Create DataTable to add data to timeline
- 			var data = new google.visualization.DataTable();
- 			data.addColumn('datetime', 'start');
-			data.addColumn('datetime', 'end');
-			data.addColumn('string', 'content');
-
-			// Loop through datasets and add data to timeline 
-			var i = -1;
- 			angular.forEach($scope.datasets, function(dataset) {
-
- 				// Keep track of dataset count for displaying colors
-				i++;
-				
- 				/* TODO should "disable overlay" also disable timeline? */
-
- 				// Get time bounds from dataset 
- 				var start = dataset.timeVals.start;
- 				var end	= dataset.timeVals.end;
-
- 				// Add different color to each bar
- 				var style = 'background-color:' + $rootScope.fillColors[i] +
- 							'; border-color:' + $rootScope.surroundColors[i] + ';';
- 				var ocwBar = '<div class="ocw-bar timeline-event-range" style="' + style + '"></div>';
-        
- 				// Add row to DataTable: object with start and end date
- 				// note: subtract one from month since indexes from 0 to 11
- 				data.addRow([new Date(start.substr(0,4), start.substr(5,2)-1, start.substr(8,2)), 
- 							new Date(end.substr(0,4), end.substr(5,2)-1, end.substr(8,2)),
- 							ocwBar ]);
- 			});
-
-			// Add user selected bounds to timeline
-			if ($scope.regionParams.areValid) {
-
-				var userStart 	= $scope.regionParams.start;
-				var userEnd 	= $scope.regionParams.end;
-
-				// Add color to user selected bounds
-				var style = 'background-color: #000000; border: 2px solid;';
- 				var ocwBar = '<div class="ocw-bar timeline-event-range" style="' + style + '"></div>';
- 				
-				// Add row to DataTable: object with start and end date
- 				// note: subtract one from month since indexes from 0 to 11
- 				data.addRow([new Date(userStart.substr(0,4), userStart.substr(5,2)-1, userStart.substr(8,2)),

- 							new Date(userEnd.substr(0,4), userEnd.substr(5,2)-1, userEnd.substr(8,2)),
- 							ocwBar ]);
-			}
- 			
-			var options = {
-	                'minHeight': "200px",
-	                'width':  "99.8%",
-	                'zoomable': false
-            };
+		// Create DataTable to add data to timeline
+		var data = new google.visualization.DataTable();
+		data.addColumn('datetime', 'start');
+		data.addColumn('datetime', 'end');
+		data.addColumn('string', 'content');
+
+		// Loop through datasets and add data to timeline 
+		var i = -1;
+		angular.forEach($scope.datasets, function(dataset) {
+
+			// Keep track of dataset count for displaying colors
+			i++;
 			
- 			// Draw timeline with data (DataTable) and options (a name-value map) 
-			$rootScope.timeline.draw(data, options);
- 		}
+			/* TODO should "disable overlay" also disable timeline? */
+
+			// Get time bounds from dataset 
+			var start = dataset.timeVals.start;
+			var end	= dataset.timeVals.end;
+
+			// Add different color to each bar
+			var style = 'background-color:' + $rootScope.fillColors[i] +
+						'; border-color:' + $rootScope.surroundColors[i] + ';';
+			var ocwBar = '<div class="ocw-bar timeline-event-range" style="' + style + '"></div>';
+	
+			// Add row to DataTable: object with start and end date
+			// note: subtract one from month since indexes from 0 to 11
+			data.addRow([new Date(start.substr(0,4), start.substr(5,2)-1, start.substr(8,2)), 
+						new Date(end.substr(0,4), end.substr(5,2)-1, end.substr(8,2)),
+						ocwBar ]);
+		});
+
+		// Add user selected bounds to timeline
+		if ($scope.regionParams.areValid) {
+
+			var userStart 	= $scope.regionParams.start;
+			var userEnd 	= $scope.regionParams.end;
+
+			// Add color to user selected bounds
+			var style = 'background-color: #000000; border: 2px solid;';
+			var ocwBar = '<div class="ocw-bar timeline-event-range" style="' + style + '"></div>';
+			
+			// Add row to DataTable: object with start and end date
+			// note: subtract one from month since indexes from 0 to 11
+			data.addRow([new Date(userStart.substr(0,4), userStart.substr(5,2)-1, userStart.substr(8,2)),

+						new Date(userEnd.substr(0,4), userEnd.substr(5,2)-1, userEnd.substr(8,2)),
+						ocwBar ]);
+		}
+		
+		var options = {
+				'minHeight': "200px",
+				'width':  "99.8%",
+				'zoomable': false
+		};
+		
+		// Draw timeline with data (DataTable) and options (a name-value map) 
+		$rootScope.timeline.draw(data, options);
 	};
 
 	$scope.$on('redrawOverlays', function(event, parameters) {



Mime
View raw message