1

I want to be able to control the slope of Bezier curves that I generate with d3.linkHorizontal() function. So far I've achieved that by changing the values directly in the node modules, but that does not seem like a correct way to do it. I want to change the following d3.linkHorizontal() function:

function curveHorizontal(context, x0, y0, x1, y1) {
  context.moveTo(x0, y0);
  context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
}

into something like this:

function curveHorizontal(context, x0, y0, x1, y1) {
  context.moveTo(x0, y0);
  context.bezierCurveTo(x0 + MyParameter, y0, x1 - MyParameter, y1, x1, y1);
}

Thank you!

gdvalderrama
  • 713
  • 1
  • 17
  • 26
  • Does this answer your question? [d3.js multiple relationship visual / linkHorizontal() / tangled tree](https://stackoverflow.com/questions/64423115/d3-js-multiple-relationship-visual-linkhorizontal-tangled-tree) – Ruben Helsloot Nov 23 '20 at 13:56
  • I don't think so, i want to change the following function inside d3.js linkHorizontal() implementation `context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);` to something like this `context.bezierCurveTo(x0 + myParameter , y0, x1 - myParameter y1, x1, y1);` – Ivana Gajic Nov 23 '20 at 14:26
  • I'd copy the rest of the code from the source, then adjust from there. If you want more help, please add a runnable [mre] of your code here, see also [ask] – Ruben Helsloot Nov 23 '20 at 14:29
  • Thank you very much!! – Ivana Gajic Nov 23 '20 at 14:30

0 Answers0