-->

performance issue using dc.js and ui-router with t

2019-03-06 00:56发布

问题:

I'm using dc.js with angular.js's ui-router. My goal is to have two routing states. Each should present multiple graphs.

Everything works fine, but everytime the routing state changes, the performance of the graphs gets slower. I think that the problem maybe is located on dc.js or my usage of it.

Everytime the routing state changes, new graphs will be invoked. Maybe dc.js doesn't delete the old ones. Is there an option in dc.js to delete the graphs?

回答1:

There is the undocumented dc.chartRegistry.deregister(chart,group):

https://github.com/dc-js/dc.js/blob/master/src/core.js#L70

But a bigger performance hit is if you are creating dimensions or groups and not disposing of them:

https://github.com/square/crossfilter/wiki/API-Reference#dimension_dispose https://github.com/square/crossfilter/wiki/API-Reference#group_dispose

This would cause more and more indices to be created, and all the data would have to get sorted and binned in more and more ways.