javascript - Multiple D3js graphs on one view cause performance isues when using responsive disign -
I have about 20 charts on the same scene, unless I try to apply the graph inside the responsive design By then, everything works properly. Each article has a different ID
I am using the cornerry instructions to make those graphs.
This piece of code is troublesome:
var the_chart = $ ("#" + attrs.id + "chart"), aspect = the_chart.attr ("width ") / The_chart.attr (" height "), container = element.parent (); $ (Window) .on ("resize", function () {var targetWidth = container_width (); the_chart.attr ("width", targetWidth); var value = monastery (target / aspect); the_chart.attr ( "Height", value);}). Trigger ("resize"); The problem is that I repeatedly say directive x number and in every instruction I call the code piece above. It will perform well for illustrations of 1 or 2, but the more graphs you have, the more performance problems. The triggers ("resize") will be the reason because many examples of $ (window) Re-submit .on ("resize" ...) has been created.
I have to be forced to resize because the width of the container is not set until the whole scene is presented.
Is there any solution What is my problem?
I had a similar problem.) My code is very slow Started. It does not help in h-shaw / ng-hiding I was confused. Director NG-If my problem is resolved.
You should create a structure like this:
& lt; Div ng-if = "...." & gt; ... & lt; / Div & gt; & Lt; Div ng- if = "...." & gt; ... & lt; / Div> & Lt; Div ng-if = "...." & gt; ... & lt; / Div & gt; ... is not:
& lt; Div & gt; .... & lt; / Div & gt; & Lt; Div & gt; .... & lt; / Div & gt; & Lt; Div & gt; .... & lt; / div & gt;
Comments
Post a Comment