Skip to content

Commit

Permalink
Add API function to refresh charts to reflect changes if options were
Browse files Browse the repository at this point in the history
updated
  • Loading branch information
Tuan Nguyen committed Apr 19, 2017
1 parent 6742bdf commit b6dc4d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions svychartjs/chart/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ angular.module('svychartjsChart', ['servoy']).directive('svychartjsChart', funct
link: function($scope, $element, $attrs) {

//refresh the chart (if options updated)
var refreshChart = function() {
$scope.api.refreshChart = function() {
if (!$scope.model.data || !$scope.model.options) {
return;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ angular.module('svychartjsChart', ['servoy']).directive('svychartjsChart', funct

//if the options are updated redraw the chart
$scope.$watchCollection('model.options', function(newValue, oldValue) {
refreshChart();
$scope.api.refreshChart();
});

//handle click events.
Expand Down
3 changes: 3 additions & 0 deletions svychartjs/chart/chart.spec
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
"drawChart":
{
},
"refreshChart":
{
},
"setOptions":
{
"parameters":
Expand Down

0 comments on commit b6dc4d0

Please sign in to comment.