Refactor setExtremes.

This commit is contained in:
Alexis Lahouze 2015-08-20 11:41:43 +02:00
parent c819b62246
commit ad60e19617

View File

@ -171,7 +171,6 @@ accountantApp
"SoldChartController", [ "SoldChartController", [
"$rootScope", "$scope", "$http", "$routeParams", "$rootScope", "$scope", "$http", "$routeParams",
function($rootScope, $scope, $http, $routeParams) { function($rootScope, $scope, $http, $routeParams) {
// Configure chart for entries. // Configure chart for entries.
$scope.config = { $scope.config = {
options: { options: {
@ -240,7 +239,9 @@ accountantApp
minRange: 3600 * 1000 * 24 * 14, // 2 weeks minRange: 3600 * 1000 * 24 * 14, // 2 weeks
events: { events: {
afterSetExtremes: function(e) { afterSetExtremes: function(e) {
$scope.selectRange(moment.utc(e.min), moment.utc(e.max)); $scope.$emit("rangeSelectedEvent", {
begin: moment.utc(e.min), end: moment.utc(e.max)
});
} }
}, },
currentMin: moment.utc().startOf('month'), currentMin: moment.utc().startOf('month'),
@ -260,10 +261,6 @@ accountantApp
useHighStocks: true useHighStocks: true
}; };
$scope.selectRange = function(begin, end) {
$scope.$emit("rangeSelectedEvent", {begin: begin, end: end});
};
$scope.loadSolds = function() { $scope.loadSolds = function() {
$scope.config.loading = true; $scope.config.loading = true;