From 0a799c51e6dc57e92a9958c748e25f95c7c9cf91 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 2 Aug 2023 12:29:20 +0200 Subject: [PATCH] #10701 D3 Tree implementation, links and colors --- pandora_console/include/javascript/d3.v7.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/javascript/d3.v7.js b/pandora_console/include/javascript/d3.v7.js index 24c9833bdd..99212f8bbd 100644 --- a/pandora_console/include/javascript/d3.v7.js +++ b/pandora_console/include/javascript/d3.v7.js @@ -20651,6 +20651,7 @@ function TreeHorizontal( halo = "#fff", // color of label halo haloWidth = 3, // padding around the labels curve = d3.curveBumpX, // curve for the link + leftalign = false, // left align svg } = {} ) { @@ -20687,9 +20688,11 @@ function TreeHorizontal( // Use the required curve if (typeof curve !== "function") throw new Error(`Unsupported curve`); - + if (leftalign == false ) { + leftalign = -dy * padding / 2 + } const svg = d3.create("svg") - .attr("viewBox", [-dy * padding / 2, x0 - dx, width, height]) + .attr("viewBox", [leftalign, x0 - dx, width, height]) .attr("width", width) .attr("height", height) .attr("style", "max-width: 100%; height: auto; height: intrinsic;") @@ -20717,11 +20720,10 @@ function TreeHorizontal( .attr("xlink:href", link == null ? null : d => link(d.data, d)) .attr("target", link == null ? null : linkTarget) .attr("transform", d => `translate(${d.y},${d.x})`); - + node.append("circle") - .attr("fill", d => d.children ? stroke : fill) - .attr("r", r); - + .attr("r", r) + .attr("fill", d => fill(d.data, d)); if (title != null) node.append("title") .text(d => title(d.data, d));