Hello and happy new year !
So, I may have found a potential bug in items events.
I want to add an item and test if the click is on some node's item (an info icon). Tryied it in Firefox and Chrome. Both doesn't give the expected output.
First click behaves right, then it's broken and the nodes behave as if it were info icons.
When I add event.clickItem = null; at the end of my onclick function, seems that the behaviour is right 1 everey 2 times.
Weird isn't it ?
That's my onclick function :
function graphClick(event, args){
if (event.clickNode){
console.log(event.clickItem);
if ((event.clickItem)&&(event.clickItem.style.extra)&&(event.clickItem.style.extra == "info")){
console.log("There is an item click : " + event.clickNode.id);
showInfo(event.clickNode);
event.preventDefault();
}
else {
console.log("The event is a click on node " + event.clickNode.id);
chart.expandNode(event.clickNode);
collapseNodesWithNoUse(event.clickNode);
event.preventDefault();
}
};
}
And here is my nodeStyle function :
function nodeStyle(node){
//console.log("Styling nodes here");
node.label = node.data.label;
node.aura = node.data.auras;
if ((node.data.fillColor != null) && (node.data.fillColor != "rgb(255,255,255)")){
node.fillColor = node.data.fillColor;
}
if (node.data.radius != null) {
node.radius = node.data.radius;
}
if ((node.data.lineColor != null) && (node.data.lineColor != "rgb(255,255,255)")) {
node.lineColor = node.data.lineColor;
}
if ((node.data.lineWidth != null) && (node.data.lineWidth != "rgb(255,255,255)")) {
node.lineWidth = node.data.lineWidth;
}
if (node.data.image) {
node.image = zoomchart_path + "icons/" + node.data.image;
}
node.items = [
{
image: zoomchart_path + "icons/info-30x30.png",
imageSlicing: [0, 0, 30, 30],
px: 1, py: -1, x: 0, y: 0,
scaleWithZoom:false,
scaleWithSize:false,
backgroundStyle:{fillColor:"#ddd", lineColor:"blue"},
extra:"info"
}];}
Am I doing something wrong ? Or is this some kind of memory leak ?
Thanks for your answers