almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

added new option to layout.hierarchical: "userControlsFreeAxis" #4182

Closed softwareCobbler closed 5 years ago

softwareCobbler commented 5 years ago

Thank you for contributing to vis.js!!

Please make sure to check the following requirements before creating a pull request:

softwareCobbler commented 5 years ago

Goshdarnit I only wanted to submit my commits (6f22b9db8981a69f3e773733da5b6f15a6720b17), I don't know how all the other ones got in there (from "gitter-badger"). I need a GIT book.

This commit does solve a question I asked on stackoverflow: https://stackoverflow.com/questions/53127971/how-can-i-set-node-positions-in-a-hierarchical-layout

Basically it overrides the LayoutEngine logic if a user has BOTH specifed this option and supplied a "free axis" value in any of their nodes within the Dataset they've bound to Network. The "free axis" is x if hierarchical.direction is "DU" / "UD", and y if it's "LR" / "RL". Undefined values for the free axis leave LayoutEngine doing what it did prior to this commit.

I added some documentation for this in './docs/network/layout.html'.