Open bioinfornatics opened 9 years ago
In the distant past, the style attribute was intended to allow this, and I think it might be extended for SVG generation. (Notice that with -Tps, you can say things like digraph G { a [style=“arbitrary(x)” ] } and there is a warning that “arbitrary” is being ignored, but actually “x arbitrary” is generated in the Postscript that is emitted.
I think the goal of limiting what can appear in the list of styles was to prevent people from shooting themselves in the foot by misspelling things.
See parse_style() in emit.c (“This is one of the worst designs in graphviz”)
Possibly there should be a style “code” that would allow sending arbitrary strings to the code generator. e.g. a [style=“code=onmouse(whatever)”]
Stephen
On Feb 18, 2015, at 8:56 AM, jonathan MERCIER notifications@github.com wrote:
Dear,
Currently dot file do not have these svg attributes http://www.w3.org/TR/SVG/script.html:
onload onfocusin onfocusout onactivate onclick onmousedown onmouseup onmouseover onmousemove onmouseout onunload onabort onerror onresize onscroll onzoom onbegin onend onrepeat Graphviz by allowing these attributes inside dot file and use them only when output format svg could to be a good solution. It has only to do copy / paste .
I am not a graphviz dev, but It seem that adding these attributes into ellson/graphviz/blob/master/lib/gvc/gvcjob.h#L190 the job is almost done.
Could you to add this minor feature ?
Thanks
— Reply to this email directly or view it on GitHub https://github.com/ellson/graphviz/issues/39.
We initially balked about adding such features, especially as svg was the only output that would use it. However, it would probably be reasonable to add some mechanism to support this. It probably should allow the escString type so that node names, etc. could be embedded.
Meanwhile, given that Graphviz does map the id attribute into the svg element, these actions can be added dynamically in javascript. For example, if id="abc" in an svg element for a node, one can do: var svgItem = document.getElementById("abc"); svgItem.setAttribute("onmouseover", "parent.doNodeData('foo')");
Cool, I tried to add this : https://github.com/bioinfornatics/graphviz/commit/623a5677ba9cfbe705657b586d01b1dd41c673bc
but I am not a graphiz dev you will do better than me
To be able to add custom action on specific node from dot file give in my case the ability to generate a dot file from my java application. And while I browse my graph on each node I could to write tho dot line and his custom javascript action. That ease the use as I do not have to store id node somewhere to write corresponding action in another file.
The idea to search a node by browsing the dom is not bat but need to write a dot file and the corresponding javascript file. And once svg generated add manually the generated javascript file as include into the svg file.
What does agget function ?
I do not undestrand why https://github.com/bioinfornatics/graphviz/blob/master/lib/common/emit.c#L2389 is never true while I put into a dot file the correpondig attributes. As:
digraph G {
A[ onmouseover="evt.target.setAttribute('opacity', '0.5');" ];
}
It appears the patch implements new edge attributes, but the test below is a graph with one node and no edges.
On Feb 19, 2015, at 10:07 AM, jonathan MERCIER notifications@github.com wrote:
What does agget function ?
I do not undestrand why https://github.com/bioinfornatics/graphviz/blob/master/lib/common/emit.c#L2389 https://github.com/bioinfornatics/graphviz/blob/master/lib/common/emit.c#L2389 is never true while I put in to a dot file the correpondig attributes. As:
digraph G { A[ onmouseover="evt.target.setAttribute('opacity', '0.5');" ]; } — Reply to this email directly or view it on GitHub https://github.com/ellson/graphviz/issues/39#issuecomment-75066971.
Oh yes. thanks you
I got it now that work and i am able to describe theses events from my dot file. I do not know if you are interested. take a loot and tell to me.
Regards
Dear,
Currently dot file do not have these svg attributes:
Graphviz by allowing these attributes inside dot file will improve usage possibility when a SVG file is generated. Use them only when output format svg could to be a good solution. It has only to do copy / paste .
I am not a graphviz dev, but It seem that adding these attributes into obj_state_s in gvcjob.h the job is almost done.
Could you to add this minor feature ?
Currently as workaround is possible to do some xml injection: example
url attributes is closed and we inject an attributes events
Thanks