Klortho / d3-flextree

Flexible tree layout algorithm that allows for variable node sizes
https://klortho.github.io/d3-flextree/
Do What The F*ck You Want To Public License
327 stars 45 forks source link

Have you updated this to d3 version 4? #6

Closed lcahlander closed 6 years ago

lcahlander commented 7 years ago

Hello,

I am working on implementing the d3 v4 tree in polymer. https://github.com/powerxhub/emh-d3-tree.git

The tree.nodeSize() takes a fixed array and not a function. https://github.com/d3/d3-hierarchy/blob/master/README.md#tree_nodeSize This seems ripe for your implementation of the flextree.

Thank you, Loren

targos commented 7 years ago

I went ahead and published d3-flextree-v4 for D3 v4 because I needed it: https://github.com/neptunjs/d3-flextree-v4 / https://www.npmjs.com/package/d3-flextree-v4 I would be happy to move it back here if wanted.

Klortho commented 7 years ago

Sorry for the long delay, guys. I spent some time on this, this past weekend, and made some progress.

I'm working in branch v4-plugin. I used @neptunjs's repo for a reference, but I found that it broke some of the tests. Right now it is not quite working, but I think it is pretty close.

Klortho commented 7 years ago

P.S. I'm definitely going to change the API somewhat. The separation() function is only in this for backwards compatibility with d3.tree, but it is really a poor fit.

Also, I really don't like how the layout function mutates the tree, and I think it would be better if it returned the "shadow tree" -- the wrapper nodes, instead. Each of those has a pointer to the node it wraps, of course, so I don't think the impact would be too bad. Any objections?

lcahlander commented 7 years ago

Have you made any progress? Can you share a copy with me? I am working on an XML/JSON Schema viewer and this is needed.

http://demo.easymetahub.com:9012/

lcahlander commented 7 years ago

Do you have an example of adding a child node to a leaf?

Klortho commented 7 years ago

I worked on it a bit more -- my work is in the v4-plugin branch. I'm working on simplifying the API, and a simple example can be found at https://github.com/Klortho/d3-flextree/blob/v4-plugin/demo/simple.html

timelyportfolio commented 7 years ago

Any updates here? I would love to help. What is broken? I have tried, and I cannot get it to work. Is this expected?

karlitos commented 7 years ago

Hello,

I am also curious about the current state and progress. Is the V4 version usable in any way ? What is broken ? How can I help ?

Klortho commented 7 years ago

Sorry, guys. I've been swamped lately. I was working in branch d4-plugin, and it's kind of a pulled-apart mess right now; in the middle of putting it back together, getting the tests working again, and the build working with rollup ... so it's hard to answer the question "what's broken".

I will work on it today, I promise. Regarding help ... if I can't get it done today, I'll at least itemize a to-do list, and comment back here.

timelyportfolio commented 7 years ago

Thanks so much, I understand completely. Please let us know if we can help in any way, but asking for help sometimes takes more time than doing, so feel free to do whatever is best. d3-flextree is so incredibly helpful, and I don't think it has attracted nearly the attention it deserves.

Klortho commented 7 years ago

Thanks for saying so -- it should be done today.

Klortho commented 7 years ago

Sorry, it's taking longer than I thought; I am working on it. I'm going to quit making specific estimates and just say, "very soon".

ram33 commented 6 years ago

@Klortho Thank you for implementing this. Any update on progress of upgrading it to v4?

emeeks commented 6 years ago

I'll be the latest asking for a v4 update. If there are some outstanding items, just let me know and I can take a look and maybe get a PR in.

Klortho commented 6 years ago

This is basically done. I'll be pushing up a draft version today. It would be great if any of you could check it out and give me suggestions on packaging build issues, mostly. One goal I had was to make it d3-independent, so I'm creating several different bundles.

Klortho commented 6 years ago

I pushed up the v4-plugin branch. The documentation is lagging behind the code. I made some API changes -- in the original implementation, I was concerned with making flextree completely compatible with tree, which made a lot of things more complicated than they needed to be. I hope I haven't simpified too drastically. E.g. some of the methods I did away with are separation(), size(), sort(), and setNodeSizes().

npm run build builds four umd bundles: non-minified and minified versions of both d3-dependent and d3-independent modules. I haven't figured out how packaging for npm will work. Suggestions welcome.

Klortho commented 6 years ago

This, I hope, is done -- I just released version 2.0.0. I changed the API somewhat, but they are mostly additions, and it should be very compatible with the existing D3 hierarchy. I wrote a lot of tests to ensure that. I did remove separation() and size() -- they are more applicable to fixed-node sized trees.

Please give it a try, and let me know if you have any problems or suggestions.