org-roam / org-roam-server

A Web Application to Visualize the Org-Roam Database
MIT License
634 stars 51 forks source link

Ability to change graph layout algorithm #141

Open spacekitteh opened 3 years ago

spacekitteh commented 3 years ago

The default settings aren't always appropriate. The ability to change the parameters of the visualisation should be included.

tefkah commented 3 years ago

What kind of things do you want to change? You can change most of the parameters with org-roam-server-network-vis-options, althought it's a bit of a pain in the ass to manually write out the \"escaped\" json.

Here are some of my options as a reference

(setq org-roam-server-network-vis-options "{
  \"physics\": {
    \"enabled\": true, 
    \"barnesHut\":{
      \"gravitationalConstant\" : -6000, \"avoidOverlap\" : 0.5, \"springLength\" : 200
    }, 
    \"stabilization\": {
      \"enabled\": true, \"iterations\": 30
    }
  }, 
  \"edges\": {
     \"physics\": true, \"hidden\": false, \"smooth\": {
       \"enabled\": false, \"type\": \"continuous\"
        }
      }
  }"
)
tefkah commented 3 years ago

You can find the options you can specify here

I've been experimenting a bit with creating easier ways of doing via (setq)s, but that turned out to be kind of annoying to do, I might give it a go again soon.

goktug97 commented 3 years ago

You can find the options you can specify here

I've been experimenting a bit with creating easier ways of doing via (setq)s, but that turned out to be kind of annoying to do, I might give it a go again soon.

Hi,

You can use json-encode For example (json-encode (list (cons 'physics (list (cons 'enabled json-false))))). It might be much easier than writing a json string by hand.