Little tweaks
I noticed that my Org (9.8-pre) didn't have :begin as a separate plist value - I think it's in the vector of :standard-properties instead. Also, removing viewBox got the SVG to show up without being cut off. Thoughts?
Hi Sacha,
How great to have a contribution from you to one of my projects! :)
For the property issue: we probably need to handle deferred property resolution now (this code was written before that was added to Org 9.7 by Ihor). AFAIK the canonical way to do that is with the function org-element-properties-resolve, but maybe there's a better way for certain properties...?
For the viewBox issue: I think you're on the right track there. For years I couldn't figure it out, which is one of the reasons I never really published this package. With some help from @josephmturner fixing some of the SVG- and image map-related bugs in Emacs, my interest was rekindled, and I noticed that the viewBox seemed to be an issue. I have a branch with recent changes, and you can see my feeble attempts to fix the viewBox here: https://github.com/alphapapa/org-graph-view/compare/master...wip/new-fixes#diff-dc24c13051aab7ab4e5a4968a6b107a39b932c5cac457822f579de3048793e34R555-R583 It does seem to mostly solve the problem, but I hadn't tried just removing the viewBox, which would be even better if it works; I need to test more thoroughly with more constrained window sizes and larger graphs. (Also you actually parse the XML like a good programmer, instead of using my regexp-on-XML hack, haha.)
Very cool use of cmapx to make it clickable; that's something I'd been wondering about for a while.
begin position doesn't seem to be in :deferred, so org-element-properties-resolve doesn't do it. It's just in :standard-properties, which I guess is a vector so as to take up less space than a plist.
Also, I noticed that the voronoi overlap algorithm sometimes gets stuck on my setup. I think it happens when I click on a leaf node in a small map. I set it to scale instead and that works out much faster for me. I wonder when it might make sense to use one or the other, or which to use as a default.
I'm interested in visualizing non-hierarchical links as well, so https://sachachua.com/web/beginner-map.html (source https://sachachua.com/web/beginner-map.org ) parses # links, filters out links back to the map, and adds them to the graph. I can imagine a variable that has a list of functions that's called to modify the graph, and one of those functions could add edge links like that. Other modification functions could set the colours/styles of nodes and edges depending on what the user is curious about. Hmm...
Ooooh, and maybe a "just this neighbourhood" sort of view, kind of like TheBrain or org-brain or an org chart... Something to visualize maybe this node's parents, collapsed siblings, one or two levels of children, and maybe links...
@sachac Thanks for your input on this graphviz rendering business!
When I remove the viewBox attribute, then the image map doesn't line up with the image. Do they line up on your machine? It may be necessary to remove the viewBox attribute in org-graph-view--graph-map also.
Perhaps this should go in a different issue, but on my machine the SVG only renders when I comment out the following two lines in org-graph-view--format-graph:
"size" (format "%.1d,%.1d" width-in height-in)
"dpi" (format "%s" dpi)
Also, if I remove both the height and width attributes (as in this patch), the graph doesn't render. Does it render on both of your machines?
Mysterious, works here for me, all lined up: nodes are clickable. Emacs version 31.0.50, Org 9.7.10
That's good! I'm on 29.4. I wonder if that plays a role...