check if stats are loaded before redraw chart

stable
Juanfran 2014-11-12 08:14:38 +01:00
parent 81fd0486e3
commit c98996a8c5
1 changed files with 4 additions and 2 deletions

View File

@ -89,13 +89,15 @@ SprintGraphDirective = ->
element = angular.element($el) element = angular.element($el)
$scope.$on "resize", -> $scope.$on "resize", ->
redrawChart(element, $scope.stats.days) redrawChart(element, $scope.stats.days) if $scope.stats
$scope.$on "taskboard:graph:toggle-visibility", -> $scope.$on "taskboard:graph:toggle-visibility", ->
$el.parent().toggleClass('open') $el.parent().toggleClass('open')
# fix chart overflow # fix chart overflow
timeout(100, -> redrawChart(element, $scope.stats.days)) timeout(100, ->
redrawChart(element, $scope.stats.days) if $scope.stats
)
$scope.$watch 'stats', (value) -> $scope.$watch 'stats', (value) ->
if not $scope.stats? if not $scope.stats?