chuckzel / cytoscape-tidytree

A Cytoscape.js layout extension for trees
https://chuckzel.github.io/cytoscape-tidytree/
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Support for different directions of the layout #3

Open michalhabala opened 1 month ago

michalhabala commented 1 month ago

Would it be possible to add support for different layout directions? Typically, users want the resulting tree to be oriented left-right or top-down, and I don't see any option to change the direction like in the other tree layouts in Cytoscape. Thank you.

daemontus commented 1 month ago

Hi! Thank you for the suggestion! This is certainly something we are considering.

@chuckzel, will you have time to look at this, or should I try to address it?

chuckzel commented 1 month ago

I will add support for this in the coming weeks. If you need the functionality sooner, it is possible to use sizeGetter and transform options for this. For example, these options result in a left-right layout:

 opts: {
    sizeGetter: (n) => {
        const dims = n.layoutDimensions();
        return { w: dims.h, h: dims.w };
    },
    transform: (n, pos) => ({ x: pos.y, y: pos.x })
 }
daemontus commented 1 month ago

Awesome, thank you!

michalhabala commented 1 month ago

Thank you very much! We are okay with waiting a few weeks for this feature. Thanks for this great layout; we can't wait to include it in our app.