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
Allow HTML Labels #19
Comments
I was curious how hard it would be to add this to this project and managed to whip up the following. I'm new to GIT (I'm more of a mercurial guy) so I don't know the proper way to send to you so I've included it as a diff below.
|
Very, very cool! Are you OK with this change being included with dagre under the MIT license? I can take the patch as is, but there are a couple of ways to get your name credited for the change (in the commit):
I can help either approach, if you'd like. |
I'm fine with it being included under the MIT license. Go ahead and commit it yourself. I don't really care about having my name credited for this (really minor) change. I'll get around to properly learning git one of these days (sooner rather than later if I keep playing with this code). Not to take this thread way too off topic, but can I ask what your thinking / thought process / rough roadmap is for continued development of this project and the D3 stuff you were/are working on (here: d3/d3#349)? Although I've used graphviz in the past, I'm not really a fan of trying to wedge its syntax into more general javascript projects and I like the look of how D3 handles data. I'm sorry I haven't completely read through all your posts to see if you've already addressed this somewhere, and if you have please feel free to just point me to it! Thanks again for your work on these projects! |
This patch comes from @robopeter in #19.
I've applied the patch to the v0.0.3 branch, which I plan to publish a little later this week. For now you can get it using I haven't done a lot of thinking on D3 integration in the last month or two - mainly because I've been trying to get the graph layout itself working. I think that the biggest change to dagre would be to make part of the pre-layout (width / height detection) and the whole of the render phase pluggable. On the data binding side, we have node and edge ids which should be able to serve as a way to bind with D3. If you have any thoughts or suggestions on this front, I welcome them. |
First of all, I should also just mention for posterity in case anyone cares that the syntax to use here is slightly different than "real" graphviz syntax in that the label value is still quoted if it's HTML Graphviz does not quote a html label, instead enclosing the html in matching '<' and '>'s instead of quotes. In our case, we just check to see if the first character of that string is a '<' character and if it is, treat the entire string (including the '<') as HTML. I'll check the adjustments later, but I think I'm fine with the whole HTML block being centered as long as the content inside of that html block respects normal HTML flow. I don't have major suggestions really besides keep up the good work and keep how you'd do the D3 stuff in back of your mind so you don't make any crazy design decisions that end up being hard to unravel later. Depending on how much time I have I'll try to see where else I can help down this road! Thanks again! |
I've opened #22 to track support for dot's HTML string specification. |
DOT syntax (as used in graphviz) allows HTML to be used as part of labels. HTML can be embeded in SVG through the use of a "foreignObject" element. Please add better support for HTML labels in dagre. Thanks!
The text was updated successfully, but these errors were encountered: