我一直在研究Infovis工具包项目,虽然所有功能都已完成,但我还是无法完成视觉效果.Infovis工具包API文档很好,但我的自定义节点类型不起作用.我正在使用高速,我想制作两种不同的自定义节点类型.一个来自图像,另一个来自绘制路径.非常感谢所有帮助,谢谢!
编辑:[我尝试的解决方案结果不是那么方便.相反,我使用来自JIT控制器的onCreateLabel()来自定义HTML节点.看到了性能的明显改善,并在定制节点方面获得了更大的灵活性.]
这是我到目前为止所提出的:
$jit.Hypertree.Plot.NodeTypes.implement({
'customNode': {
'render': function(node, canvas) {
var img = new Image();
img.src = "../icon.png";
var pos = node.pos.getc(true);
var ctx = canvas.getCtx();
ctx.drawImage(img, pos.x-15, pos.y-15);
/*
//...And an other one like this but drawn as a path
ctx.beginPath();
ctx.moveTo(pos.x-25, pos.y-15);
ctx.lineTo(25, -15);
ctx.lineTo(-35, 0);
ctx.closePath();
ctx.strokeStyle = "#fff";
ctx.fillStyle = "#bf5fa4";
ctx.fill();
ctx.stroke();*/
}
}
});
Run Code Online (Sandbox Code Playgroud)