javascript - How to make custom nodes in Infovis Toolkit? -


I am working on an Infosys Toolkit project and although all the functions are completed, I can not complete the views I am here. Infovis Toolkit API documentation is good, but my custom node type does not work. I am using a hypertray and I want to create two different custom node types. The one who is from one image and the other is in the form of the drawn route, all help is greatly appreciated, thanks!

Edit: [The one that I was trying to do was not very easy. Instead, I used JIT controllers to customize nodes with HTML on cratabelabel (). Seeing improved performance and more flexibility in optimizing nodes. ]

This is what I have done so far:

  $ jit.Hypertree.Plot.NodeTypes.implement ({'customNode': {'rendere': function (Node, canvas) {var img = new Image (); img.src = "..//onon.png"; var pos = node.pos.getc (true); var ctx = canvas.getCtx (); ctx .drawImage (img, pos.x-15, pos.y-15); / * // ... and this is another one, but path has been prepared as ctx.beginPath (); ctx.moveTo (Pos.x-25, condition.-15); ctx.lineTo (25, -15); ctx.lineTo (-35, 0); ctx.closePath (c); ctx.strokeStyle = "#fff"; ctx. FillStyle = "# Bf5fa4"; ctx.fill (); ctx.stroke (); *}}}};    

Because you are setting an image source on the file URL, it takes time Load the file so the code is knocking drawImage before the image is loaded.

You can see this code to run drawImage calls by modifying your code and the onload event handler for the image (which runs once the image is loaded ).

  $ jit.Hypertree.Plot.NodeTypes.implement ({'customNode': {'rendere': function (node, canvas) {var img = new Image (), pos = node Pos.getc (true), ctx = canvas.getCtx (); img.onload = function () {ctx.drawImage (img, pos.x - 15, position.-15);}} img.src = '.. /icon.png ';}}});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -