Domanda

Hello I am using the infovis toolkit to draw an organisational chart,in order to accomplish this I need to draw a graph inside a graph node (I have this part working)

The problem is at what point in my code do I test that the parent graph is ready to be manipulated. I have tried testing when the canvas is ready, when the canvas is live, and also when the div label that I am writing the child graph to is ready however none of these seem to work and report

Cannot read property offsetWidth of null

which is because it cannot read the width of an element which does not yet exist and this is because even though the dom registers it the canvas hasn't finished rendering it yet.

Does anybody know in infovis to test for a graph being ready to be manipulated?

Thanks

scrineym

È stato utile?

Soluzione

I figured out the answer, there isn't a definite way for testing the canvas is ready ,

however when creating the tree in infovis there is two functions onBeforeCompute and onAfterCompute

onAfterCompute is fired when the graph is finished loading, so you can place any necessary code in there and it will run when the graph is finished rendering.

Hope this helps !!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top