Created
June 9, 2015 18:30
-
-
Save fforres/0f462d7684fd4f67dbd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stackedHorizontalBarGraphVentas() { | |
return { | |
restrict: 'E', | |
scope: { | |
selectedTab: "=", | |
graphTotalData: "=", | |
graphMetaData: "=", | |
graphData: '=' | |
}, | |
controller: function($scope, $window) { | |
$scope.w = angular.element($window); | |
$scope.theData = [ | |
20, 40, 50 | |
] | |
}, | |
templateUrl: "lib/custom/charts/stackedHorizontarBarChart/chart.html", | |
link: function($scope, element, attrs) { | |
$scope.attrs = attrs; | |
$scope.element = element; | |
$scope.isChild = attrs.ischild == "" ? true : false; | |
$scope.$watch( | |
function() { | |
return $scope.selectedTab; | |
}, | |
function(newValue, oldValue) { | |
if (newValue != oldValue) { | |
//HAY UN CAMBIO DE TAB | |
$scope.redrawGraphs($scope.theData[Math.floor((Math.random() * 4))]) | |
} | |
}); | |
window.onresize = function() {}; | |
$scope.getTheRest = function(data) { | |
$scope.graph = stackedHorizontalBarChartVentas | |
.draw($scope.element.find(".chart")[0]) | |
.data(data) | |
.onClick($scope.callback) | |
.render() | |
} | |
$scope.callback = function() { | |
console.log(this) | |
} | |
$scope.getTheRest({ | |
graphData: $scope.graphData, | |
graphTotalData: $scope.graphTotalData, | |
graphMetaData: $scope.graphMetaData, | |
isChild: $scope.isChild | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment