1

I'm trying to create a custom shape and set x and y axis on the svg, so far I got it done but for on top of my element I have a transform attribute that belongs to a group (g) that references the node, I tried to change the attribute setting a custom transform but without any luck.

my question is, how can I change the x and y position for the whole node?

render.shapes().task = function(parent, bbox, node) {
    var shapeSvg = parent.insert('rect', ':first-child')
    .attr('x', node.x)
    .attr('y', node.y)
    .attr('width', bbox.width)
    .attr('height', bbox.height);

    parent.attr('transform', 'translate(' + node.x + ',' + node.y + ')');
    node.intersect = function(point) {
        return dagreD3.intersect.rect(node, point);
    };
    return shapeSvg;
};

for generating the node:

g.setNode(String(element._id),
{
    label:element.flowElement.meta.name,
    shape:element.type,
    x:meta.x,
    y:meta.y,
    width:meta.width,
    height:meta.height
}

the translate is 65,152 and I want to be the same as x and y of the object an also I want to change the child groups (including the wrappers for the labels) as well.

look at the image for reference svg transform with dagre

pedrommuller
  • 15,741
  • 10
  • 76
  • 126

0 Answers0