We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am tring to plot a horizontally placed graph, but got a little problem.
Below is the original graph from https://codepen.io/brinkbot/pen/oNQwNRv
After swipe the x and y by following code(change from line 144):
var { height, width } = layout(graph); function TransNode(node){ console.log("transform", node.data) let tmp = node.ux; node.ux = node.uy; node.uy = tmp; } function TransGraph(g){ let tmp = width; width = height; height = tmp; for (let node of g.nodes()){ TransNode(node); } for (let link of g.links()){ let points = []; points.push([link.source.ux, link.source.uy]); points.push([link.target.ux, link.target.uy]); link.points = points; } } TransGraph(graph);
The result graph become this:
It seems like the path between nodes differed. But I don't known how to make it work. Could you please help me?
Or is there an option to plot horizontally placed graph directly?
The text was updated successfully, but these errors were encountered:
you probably missed all of the x's and y's. Fortunately, this is now built in in the form of a tweak.
When constructing the layout function, there's a line in the example:
.tweaks([shape]);
All you need to do is add another tweak to flip it:
.tweaks([shape, d3dag.tweakFlip()]);
The edges will still look a bit weird due to the spline interpolation of d3. To fix that, change
const line = d3.line().curve(d3.curveMonotoneY);
to
const line = d3.line().curve(d3.curveMonotoneX);
You should then see:
Sorry, something went wrong.
No branches or pull requests
I am tring to plot a horizontally placed graph, but got a little problem.
Below is the original graph from https://codepen.io/brinkbot/pen/oNQwNRv
![image](https://private-user-images.githubusercontent.com/3347603/259908853-6d49d5c9-d359-4bd2-8ad1-e0f97468e4a2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEyMDg4NjcsIm5iZiI6MTcyMTIwODU2NywicGF0aCI6Ii8zMzQ3NjAzLzI1OTkwODg1My02ZDQ5ZDVjOS1kMzU5LTRiZDItOGFkMS1lMGY5NzQ2OGU0YTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTdUMDkyOTI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDcyNjhmNDcwNDMzZDIzZDI4N2NhNmFmMTJhYjlkM2FhZjE1OWI2MmIxZmJhNjQ0ZDE3ZmQ5ODMzMTJiMTM3MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.PJINAzXrPoC-qZiclZIs_4XQju2JaBhJMf5Wk11sdOk)
After swipe the x and y by following code(change from line 144):
The result graph become this:
![image](https://private-user-images.githubusercontent.com/3347603/259909008-ae04ae30-026a-424a-a4ef-31ba28fcdacf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEyMDg4NjcsIm5iZiI6MTcyMTIwODU2NywicGF0aCI6Ii8zMzQ3NjAzLzI1OTkwOTAwOC1hZTA0YWUzMC0wMjZhLTQyNGEtYTRlZi0zMWJhMjhmY2RhY2YucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTdUMDkyOTI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmUxOTMyY2E2NTRhYWUzZGQxNTQ0MGVlOGI2NDMwYjJhNzE4MzYxNzMzYjExZWI2MmEwYTg2M2E2M2JjOWE5NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.3ABY8yovZjTU--0vQIPqsyh0g0JDRgsneXxGn5JaknI)
It seems like the path between nodes differed. But I don't known how to make it work. Could you please help me?
Or is there an option to plot horizontally placed graph directly?
The text was updated successfully, but these errors were encountered: