Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
watch data and options
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcraig committed Sep 4, 2016
1 parent f752b58 commit 84e8e52
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bower_components/
node_modules/
!.gitkeep
.DS_Store
npm-debug.log
5 changes: 2 additions & 3 deletions dist/tc-angular-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ function TcChartjsFactory() {
};
}

$scope.$watch('data', function ( value ) {
if (value) {
$scope.$watch('[data, options]', function (value) {
if (value && $scope.data) {
if (chartObj && typeof chartObj.destroy === 'function') {
chartObj.destroy();
}
Expand All @@ -139,7 +139,6 @@ function TcChartjsFactory() {

if (showLegend) {
$scope.legend = chartObj.generateLegend();
console.log($scope.legend);
}

if (autoLegend) {
Expand Down
2 changes: 1 addition & 1 deletion dist/tc-angular-chartjs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/tc-angular-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ function TcChartjsFactory() {
};
}

$scope.$watch('data', function ( value ) {
if (value) {
$scope.$watch('[data, options]', function (value) {
if (value && $scope.data) {
if (chartObj && typeof chartObj.destroy === 'function') {
chartObj.destroy();
}
Expand All @@ -117,7 +117,6 @@ function TcChartjsFactory() {

if (showLegend) {
$scope.legend = chartObj.generateLegend();
console.log($scope.legend);
}

if (autoLegend) {
Expand Down

0 comments on commit 84e8e52

Please sign in to comment.