TomNeyland / angular-dc

AngularJS directives for dc.js
http://tomneyland.github.io/angular-dc/
MIT License
112 stars 59 forks source link

Monthly Index reset in the stock demo does not work #9

Open zhiboz opened 10 years ago

zhiboz commented 10 years ago

Many thanks for a great library! Noticed one small issue with the stock demo:

After selecting a date range to zoom in from the view finder (barChart below the Monthly Index areaChart), you may click 'reset' on top of the areaChart, but it does not reset the view finder.

tom-coefficient commented 10 years ago

Looking into this

bwinchester commented 10 years ago

You're talking about a range chart. I coded a fix in angular-dc.js. Look for the first 2 lines in this example where a click listener is attached, Line 173 in the current source. Replace the event listener anon function with what is displayed below. It looks to see if you have a range chart specified, and if so, call .filterAll() crossfilter method on it, which resets it.

// populate the .reset childrens with necessary reset callbacks
 var a = angular.element(iElement[0].querySelector('a.reset'));
 a.on('click', function() {
       chart.filterAll();
       if(iAttrs.dcRangeChart){
             var rangeChart = scope.$eval(iAttrs.dcRangeChart);
             rangeChart.filterAll();
       }
       dc.redrawAll();
     });