Closed bontorhumala closed 9 years ago
Hi @bontorhumala, your code nearly works, there are only small changes to do. You can find a working example here: http://plnkr.co/edit/zdvieM?p=preview
$scope.$watch('range', function() {}, true)
If you want to watch for changes inside an object you have to do a deep watch, the normal watch only checks if a new value is assigned to $scope.range
.
The chart only rerenders and applies the new displayFormat
when something in the options change. The code you apply inside the watcher sets the same configuration as earlier, because you link the same selectFormat
function again.
There are multiple ways to solve this. An easy solution would be to simply update some value inside the options to trigger the watchers inside of angular-chart.
$scope.$watch('range', function() {
console.log("range changed");
$scope.options.chart.updated = (new Date()).getTime();
}, true);
I hope this solves your problems.
Hello, how can I update the Dimensions dynamically to change how date is presented on x-axis? I have a dropdown button where user can pick specific time range to display data and would like to $scope.options to pick the changes automatically. Using $scope. doesnt seem to work: