diff --git a/app/app.js b/app/app.js index 7c32ce5..1ca0655 100644 --- a/app/app.js +++ b/app/app.js @@ -43,13 +43,17 @@ app.value("allData",{ app.controller("mainController", ["allData","$scope",function (allData,$scope) { - $scope.data = {}; - $scope.data.chooserDimensions = allData.dimensions; - $scope.data.chosenDimension = undefined; - $scope.data.chooserMeasures = allData.measures; - $scope.data.chosenMeasure = undefined; + init(); - $scope.data.values = allData.values; + function init() { + $scope.data = {}; + $scope.data.chooserDimensions = allData.dimensions; + $scope.data.chosenDimension = undefined; + $scope.data.chooserMeasures = allData.measures; + $scope.data.chosenMeasure = undefined; + + $scope.data.values = allData.values; + } $scope.allowDrop = function(ev,location) { // var prevLocation = ev.dataTransfer.getData("location"); @@ -128,4 +132,16 @@ app.controller("mainController", ["allData","$scope",function (allData,$scope) { } } + + function getRandomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + } + + $scope.plotRandom = function () { + var indexDimension = getRandomInt(0,($scope.data.chooserDimensions.length - 1)); + var indexMeasure = getRandomInt(0,($scope.data.chooserMeasures.length - 1)); + + moveData("chooser.dimension","chosen.dimension", $scope.data.chooserDimensions[indexDimension]); + moveData("chooser.measure","chosen.measure", $scope.data.chooserMeasures[indexMeasure]); + } }]); diff --git a/app/directives/directives.js b/app/directives/directives.js index 9fafcfb..f5a82ce 100644 --- a/app/directives/directives.js +++ b/app/directives/directives.js @@ -8,7 +8,7 @@ app.directive("dynamicChart", function (d3Tip) { $scope.chartTypeChosen = $scope.chartTypes[0]; $scope.$watch("[chartData,chartAxisLabel,chartTypeChosen]",function(){ - console.log([$scope.chartData,$scope.chartAxisLabel]); + // console.log([$scope.chartData,$scope.chartAxisLabel]); if ($scope.chartTypeChosen && $scope.chartData){ drawChart($scope.chartTypeChosen,$scope.chartData,$scope.chartAxisLabel); } @@ -300,7 +300,7 @@ app.directive("dynamicChart", function (d3Tip) { var indexDirection = Math.floor(midAngle/360 *8); var direction = availableDirection[indexDirection]; - console.log(direction); + // console.log(direction); return direction; }) .offset(function (d) { @@ -312,8 +312,8 @@ app.directive("dynamicChart", function (d3Tip) { var extraRadius = 15; var posCentre = [-extraRadius*Math.sin(midAngle),-extraRadius*Math.cos(midAngle)]; - console.log(midAngle*180/Math.PI); - console.log(posCentre); + // console.log(midAngle*180/Math.PI); + // console.log(posCentre); return posCentre; }); diff --git a/index.html b/index.html index 43538aa..ff6d03d 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,11 @@