tgdwyer / WebCola

Javascript constraint-based graph layout
http://marvl.infotech.monash.edu/webcola/
MIT License
2.02k stars 258 forks source link

How to use without d3 #230

Open eskimoblood opened 7 years ago

eskimoblood commented 7 years ago

Hi, this is more a questions then an issue. I wonder if there is a way to use the cola without d3. As we use another library to render our chart it would be cool if could use cola to calculate the coordinates for the nodes and gives this data our chart library.

yochannah commented 7 years ago

I do agree that better non-d3 documentation would be nice, as almost all the examples use d3 by default, which is a bit frustrating. The best documentation I found was inside the tests, like this:

https://github.com/tgdwyer/WebCola/blob/893f1ae744f35b83c59451836065ef0d1897a688/WebCola/test/apitests.ts#L83-L100

that said - I'm in the midst of converting my project to d3 anyway because things weren't laying out the way I expected and I couldn't tell where the fault lay. Figures ;)

gordonwoodhull commented 7 years ago

I think cola only directly uses d3 for the drag interface and the timer. Also I think the top example on the cola homepage uses three.js and not d3.

I don't know if it's helpful, but you could look at the adaptor that dc.graph.js uses for cola: https://github.com/dc-js/dc.graph.js/blob/master/src/cola_layout.js

It's still a d3-based library, but the cola stuff is pretty well isolated so you can see the inputs and outputs.

marcospassos commented 7 years ago

I'm also looking for an example without D3, and could not find one.

ancashoria commented 7 years ago

Yeah, some examples without D3 would be very useful. We just want to use cola for node positions and render them in react or whatever. Thanks

cawfree commented 4 years ago

Here's a React Wrapper for WebCola.

jotaf98 commented 4 years ago

A vanilla HTML example would be very helpful, especially since it could be easily modified for any framework (or no framework).

Qix- commented 3 years ago

The bigger problem is that the distribution includes D3 as dependencies anyway, and then you can't bundle them from NPM with e.g. Rollup.

What would be the best solution is a distribution of Cola that just includes the layout sources in module form and a separate module for marrying them to D3 if one chooses, as not everyone wants or needs to use D3 but is penalized for doing so anyway.

Further, not everyone wants to use CommonJS, and a decreasing amount of projects are using that module format nowadays.

baughmann commented 3 years ago

+1

g-a-v-i-n commented 10 months ago

+1