Comments (8)
by the way... this link was broken https://erikbrinkman.github.io/d3-dag/
from d3-dag.
This was by design. Dags are supposed to be created with any of the creation functions (connect
, hierarchy
, stratify
), but not created manually, which is why those members were not exported.
Is there a reason why you need to create nodes manually? I'm not overly opposed to exporting them, but I would want to see a compelling argument to. Part of the benefit of "controlling" dag creation is to prevent someone creating a cycle or something else which would break expected invariants around dags.
you also point to the fact that:
import { LayoutDagRoot, LayoutDagNode, LayoutChildLink } from 'd3-dag/dist/dag/node';
will compile in an IDE, but does not work at runtime. I think this is due to the poor way that I export types. It's evolved over time, but isn't great. I think I have a solution though, so I'll address and fix that problem separately.
from d3-dag.
can you provide detailed typescript example/doc/urls of using connect(), hierarchy(), stratify() ?
Can I still control it objets by objets (given that I already have a graph of objects in typescript), or do I need to fully export it in a typescript (json?) array, and import it in one method call.
from d3-dag.
Thanks for pointing that out. I just fixed the documentation which should be up now and should answer your questions. There was an update to typedoc, so unfortunately some of the links in the documentation are going to be broken until I fix it, but it should be pretty easy to figure out where they were pointing.
If you already have typescript objects that look like a dag, then you can use hierarchy
which is exported as dagHierarchy()
until I resolve the common js / es module stuff. Say for example that you had objects with the following interface:
interface MyObj {
uniqueString: string;
nextObjects: MyObj[];
}
then you could create a dag with:
const myDag: Dag<MyObj> = dagHierarchy().id(obj => obj.uniqueString).children(obj => obj.nextObjects)(root)
from d3-dag.
ok, looks good
this also raises another question:
In my typescripts objects, I have several types of objects and several types of ChildLink (LinkData) dependencies.
Is it possible with dagHierarchy() to enrich the method ".children(obj => childObjects)" to have instead ".childLinks(obj => childObjectLinks)" where a childLinkObject would be a pair of object reference and user-defined LinkData .
I would like to use these LinkData attribute to give different style and behavior on rendered graphical elements.
from d3-dag.
Look at the documentation (which unfortunately seems to do a poor job with the typescript annotations, the source is probably a better place to turn). Instead of children you can use childrenData
from d3-dag.
As of version 0.7 (which has some breaking changes), the full build should be pushed, so importing from d3-dag/dist/...
should now work in case you really still need LayoutDagNode, although I will caution that it's use still isn't recommended.
from d3-dag.
A new version 0.8 which is effectively 1.0-rc is out. The documentation should be up to date and mostly working, although there are probably a few missing things here and there. Everything is updated, although I did remove the ability to create your own nodes automatically.
Let me know if you're still unable to do what you want. Otherwise I'm going to close this in a week or so.
from d3-dag.
Related Issues (20)
- Basic TypeScript type check error HOT 6
- Tips for writing my own layering HOT 2
- General question about node ordering HOT 2
- Specific key order appears to cause decrossOpt to hang HOT 4
- TS: Errors with typescript version 4.9.4 HOT 3
- example code not runable HOT 4
- How to plot a horizonal sugiyama graph HOT 1
- Guidance on Implementing Radial Drawing with d3-dag's Sugiyama Algorithm HOT 3
- Implement Brandes/Kรถpf Coordinate Assignment
- Expand d3-dag to handle multiple paths from parent->child HOT 4
- Dynamic nodeSize? HOT 1
- TS, export SugiNode<NodeDatum = unknown, LinkDatum = unknown> ? HOT 3
- TS Sugestion(?) HOT 4
- Possible linking bug in docs HOT 3
- elkjs, external layout algorithms? HOT 1
- is it possible to establish node order explicitly in grid? HOT 8
- Support for TypeScript <4.5
- How to extend DagNode in vanilla js? HOT 6
- Error: size of dag to decrossOpt is too large and will likely crash instead of complete, enable "large" grahps to run anyway HOT 9
- Layout direction HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-dag.