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

和自甴很熟 提交于 2019-12-02 14:39:44

问题


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.



来源:https://stackoverflow.com/questions/27128965/performance-issue-using-dc-js-and-ui-router-with-tabs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!