From commits-return-326-apmail-climate-commits-archive=climate.apache.org@climate.incubator.apache.org Mon Jul 8 23:42:47 2013 Return-Path: X-Original-To: apmail-climate-commits-archive@minotaur.apache.org Delivered-To: apmail-climate-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B1DD10FDA for ; Mon, 8 Jul 2013 23:42:47 +0000 (UTC) Received: (qmail 34161 invoked by uid 500); 8 Jul 2013 23:42:47 -0000 Delivered-To: apmail-climate-commits-archive@climate.apache.org Received: (qmail 34136 invoked by uid 500); 8 Jul 2013 23:42:47 -0000 Mailing-List: contact commits-help@climate.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.incubator.apache.org Delivered-To: mailing list commits@climate.incubator.apache.org Received: (qmail 34129 invoked by uid 99); 8 Jul 2013 23:42:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 23:42:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2013 23:42:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 24D632388860; Mon, 8 Jul 2013 23:42:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1501017 - /incubator/climate/trunk/rcmet/src/main/ui/app/js/controllers/TimelineCtrl.js Date: Mon, 08 Jul 2013 23:42:23 -0000 To: commits@climate.incubator.apache.org From: joyce@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130708234223.24D632388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 = '
'; - - // 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 = '
'; - - // 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 = '
'; + + // 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 = '
'; + + // 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) {