Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support graphviz attrs more formally #97

Closed
gordonwoodhull opened this issue Dec 19, 2018 · 2 comments
Closed

support graphviz attrs more formally #97

gordonwoodhull opened this issue Dec 19, 2018 · 2 comments

Comments

@gordonwoodhull
Copy link
Contributor

gordonwoodhull commented Dec 19, 2018

Many, many of the attributes have equivalents in graphviz (spec) or were directly based on them.

They have different names and are mostly driven by generic accessors rather than assuming particular attribute names in the data.

explore.html provides mapping for a lot of these (some unrelated stuff in here too):

.nodeLabel(function(n) { return nvalue(n).label && nvalue(n).label.split(/\n|\\n/); })
.nodeLabelPadding(5)
.nodeShape(function(n) { return nvalue(n).shape; })
.nodeFill(function(n) { return nvalue(n).fillcolor || 'white'; })
.edgeLabel(function(e) { return e.value.label ? e.value.label.split(/\n|\\n/) : ''; })
.edgeArrowhead('vee')
.edgeLength(function(e) {
var e2 = exploreDiagram.getWholeEdge(e.key);
return 15 + Math.hypot(e2.source.dcg_rx + e2.target.dcg_rx, e2.source.dcg_ry + e2.target.dcg_ry);
})
.edgeStroke(function(e) { return e.value.color || 'black'; })
.edgeStrokeDashArray(function(e) {
switch(e.value.style) {
case 'dotted':
return [1,5];
}
return null;
});

but it would be better to move all of these into a utility that simple-viewer.html can also use, and expand on them.

Then here's the fun part: run through the whole gallery of graphviz examples and see how many we can get to the same level of functionality.

We're still missing a lot, including big things like clusters and html-ish nodes, but we have enough that it's worth comparing. This mapper will also be helpful documentation.

(Today I found an example that's just for testing arrowheads - would have been helpful a few weeks ago when I implemented these. Of course, it doesn't work yet because many attributes are not mapped in simple-viewer.)

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jan 7, 2019

Have yet to test the corpus but we have dc_graph.apply_graphviz_accessors applying 14 different attributes from the spec, and also dc_graph.snapshot_graphviz to produce "graphviz json" format using the current accessors.

The simple viewer has an option to apply these. (explore.html continues to apply all of them.)

Closing.

@gordonwoodhull
Copy link
Contributor Author

See #106 for some difficulties with defaults around directedness.

An unintended consequence is that if you apply graphviz attributes you also have to apply graphviz defaults, which look pretty archaic. Hope to find some way to hybridize in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant