Title: SVG title Post by: Snorri B. on October 03, 2018, 06:28:52 pm Hi.
I'm playing a bit with the SVG library. i'm trying to add hovering text when the mouse is over an element. Google tells me I need to add the title element to my object, something like Code
How can I achieve this? I seems there is no helper function for adding this particular DOM element. Regards, -Snorri Title: Re: SVG title Post by: Sebastien F. on October 04, 2018, 09:25:21 am Hi Snorry,
You are right we are missing a title() function in fglsvgcanvas.4gl library. We will review this, thanks for the suggestion! Quick workaround: You need om.DomDocument.createChars() to create the text element for the title node, but the om.DomDocument object used by fglsvgcanvas is not exposed so you have to add this function in the lib: Code
Then you can build the title node as follows: Code
Seb Title: Re: SVG title Post by: Snorri B. on October 04, 2018, 01:04:23 pm Thanks Seb.
The problem is that the rect object is a DomNode, not DomDocument. There is no CreateElement on DomNode. I need the title on the rect, is that possible? Snorri. Title: Re: SVG title Post by: Snorri B. on October 04, 2018, 01:42:00 pm Sorry Seb, I have this working now so please ignore my last post.
Thanks a lot for your help! Regards, -Snorri Title: Re: SVG title Post by: Reuben B. on October 05, 2018, 01:46:28 am I think you can also do it without having to expose the DomDocument by using the @chars keyword for both node and attribute name of the text node
Code
Title: Re: SVG title Post by: Snorri B. on October 05, 2018, 11:27:31 am Thanks Seb. This works like a charm. No need to hack the library :)
Cheers, -Snorri Title: Re: SVG title Post by: Sebastien F. on October 05, 2018, 11:36:08 am Last suggestion was from Reuben ;-)
Seb Title: Re: SVG title Post by: Snorri B. on October 05, 2018, 11:39:39 am Thanks Reuben!
And have a nice weekend y'all. Regards, -Snorri Title: Re: SVG title Post by: Sebastien F. on October 05, 2018, 12:13:44 pm Snorri,
You may also want to take a look at the demos we have on our Github: https://github.com/FourjsGenero/fgl_svg_chart Seb |