I am currently facing an issue with the nvd3-line-chart directive in my AngularJS application. The chart does not redraw when I change the underlying model...
As a newcomer to AngularJS, there may be something obvious that experienced programmers will notice right away, but it's driving me crazy :-)
After searching on stackoverflow for similar problems, I only found solutions related to more complex issues like realtime charting. All I want is to update the data once when a link is clicked...
I have created a Plunker example here:
http://plnkr.co/edit/TkyHhbfi0vNw1FJ6mYZC?p=preview
The directive is being used as follows:
<nvd3-line-chart data="exampleData" showXAxis="true" showYAxis="true"
tooltips="true" xAxisTickValues="xAxisTicks()"
xAxisTickFormat="xAxisTickFormat()"
yAxisTickFormat="yAxisTickFormat()" interactive="true" objectEquality="true">
</nvd3-line-chart>
(I also tried setting objectEquality to false, but the behavior remained the same)...
In my JavaScript code, I set new content in a subfunction (callback from HTTP transfer) using the following:
$scope.exampleData = data;
To ensure everything is being called correctly, I also added a label (xxx) and modified it in the function call from click to yyy which worked - so data binding and scope availability seem to be okay?
The same function is used for initial data fill, which works without any issues...
Can anyone provide some insight into this problem?
By the way, I came across a functioning example but can't pinpoint the difference (aside from them calling it from native JavaScript, requiring manual updating of the component, which didn't work for me since I'm already in an Angular update cycle):