Whenever I click on one of the points it causes the chart to update. This only happens if I've got an ngClick
directive on the <nvd3>
element (even if the listener function does nothing). If I remove the ngClick
, everything's fine.
I'm using a pretty basic nvd3
scatter chart with angular-nvd3
.
What could be causing this strange interaction?
(The framerate of this recording is low, so it's hard to see but the chart is redrawn on each click, including the top one)
Here's a plunker that reproduces the issue:
http://plnkr.co/edit/F0ZslBaisoHWIp0VcI8o
Thanks!
UPDATE I've narrowed it down to a watch within angular-nvd3. Somehow the presence of the ngClick is causing the 'data' to change. This line is triggering the refresh: https://github.com/krispo/angular-nvd3/blob/master/dist/angular-nvd3.js#L328 There's nothing in my code that changes 'data' (also verified the object is the same instance outside the directive), and there's nothing I can see in angular-nvd3.js that could change the data at all... hmmm...
UPDATE Here's my click event listener (it's empty):
controller.handleChartClick = function(event) {
};
and html:
<div class="col-sm-10">
<nvd3 ng-click="observationsCharts.handleChartClick($event)"
options="observationsCharts.scatterPlotChartOptions"
data="observationsCharts.scatterPlotChartData"></nvd3>
</div>