SVG - Action with javascript
-
- Posts: 4
- Joined: Tue Oct 06, 2009 10:48 am
- antibot: No, of course not.
SVG - Action with javascript
Hi,
I use JFreeChart (and batik) for generate a SVG, that I include into a html page.
I need to use javascript for hide a serie, but my problem is the id of SVG'elements, who are not really useable.
Has anyone a method for overwrite this id with JFreeChart objects ?
Thanks for any help !
Sébastien
I use JFreeChart (and batik) for generate a SVG, that I include into a html page.
I need to use javascript for hide a serie, but my problem is the id of SVG'elements, who are not really useable.
Has anyone a method for overwrite this id with JFreeChart objects ?
Thanks for any help !
Sébastien
Re: SVG - Action with javascript
Hi Sébastien,
You should take a look at the paper I just presented at the SVG Open 2009 where I added javascript interactivity etc. to JFreeChart / Batik / SVG. I didn't set the id of any elements, but you should be able to do so using the AttributePaint class that I developed.
-Jonathan
You should take a look at the paper I just presented at the SVG Open 2009 where I added javascript interactivity etc. to JFreeChart / Batik / SVG. I didn't set the id of any elements, but you should be able to do so using the AttributePaint class that I developed.
-Jonathan
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: SVG - Action with javascript
Very cool. If you are looking for the URL, scan this list for "Leech, Jonathan":
http://www.svgopen.org/2009/registratio ... e_speakers
http://www.svgopen.org/2009/registratio ... e_speakers
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: SVG - Action with javascript
Whoops - meant to post the URL! http://www.svgopen.org/2009/registratio ... gs#paper_7 - The paper is entitled "Enhancing Server-Side SVG Generation using the Batik Extension Handler Mechanism" and the links to the abstract, paper, and presentation should appear at the top of the browser.
-
- Posts: 4
- Joined: Tue Oct 06, 2009 10:48 am
- antibot: No, of course not.
Re: SVG - Action with javascript
Hi David, Jonathan,
Thank you for those responses. That seems very well !
I try your approach immediatly.
Sébastien
Thank you for those responses. That seems very well !

I try your approach immediatly.
Sébastien
-
- Posts: 4
- Joined: Tue Oct 06, 2009 10:48 am
- antibot: No, of course not.
Re: SVG - Action with javascript
Jonathan,
For me, the pattern class work fine, but AttibutePaint or TooltipPaint classes does not.
The element added doesn't appear into the svgfile generated.
This code works fine :
This doesn't :
I generate SVG file with this code (that works for apply a pattern) :
I don't know where is my mistake ! Can you help me, again ?
For me, the pattern class work fine, but AttibutePaint or TooltipPaint classes does not.
The element added doesn't appear into the svgfile generated.
This code works fine :
Code: Select all
Paint p = SVGPatternTexturePaint.createStarPaint(14,Color.getHSBColor((float)Math.random()*255, (float)Math.random()*255, (float)Math.random()*255), Color.WHITE);
stackedbarrenderer.setSeriesPaint(i, p);
Code: Select all
Paint pt = new TooltipPaint("ToolTip : ", "test");
stackedbarrenderer.setSeriesPaint(i, pt);
Code: Select all
SVGGraphics2D svgGenerator = SVGPatternTexturePaint.getSVGGraphics2D();
-
- Posts: 4
- Joined: Tue Oct 06, 2009 10:48 am
- antibot: No, of course not.
Re: SVG - Action with javascript
I am solving my problem :
What more easy ?! 
Now, informations are generated into svg file but the tooltips doesn't appear on the SVG with IE
So, if you can help me ...
Thanks,
Sébastien
Code: Select all
SVGGraphics2D svgGenerator = new ExtensionSVGGraphics2D();

Now, informations are generated into svg file but the tooltips doesn't appear on the SVG with IE

So, if you can help me ...
Thanks,
Sébastien
Re: SVG - Action with javascript
Hi Sébastien,
Which SVG viewer are you using in IE? Adobe SVG viewer? Do the tooltips work for you in another browser - Firefox, Chrome etc?
You probably need to include tooltip.js into the SVG output - The extension doesn't do it for you.
Some browsers will do tooltips without the extra help - Opera will do a tooltip with just the "title" attribute, the Batik squiggle browser will provide a tooltip with both "title" and desc.
Also, not sure if you realized or not, you can combine multiple paints using the provided CompositePaint class.
Thanks for being the first user! Your feedback is appreciated.
-Jonathan
Which SVG viewer are you using in IE? Adobe SVG viewer? Do the tooltips work for you in another browser - Firefox, Chrome etc?
You probably need to include tooltip.js into the SVG output - The extension doesn't do it for you.
Some browsers will do tooltips without the extra help - Opera will do a tooltip with just the "title" attribute, the Batik squiggle browser will provide a tooltip with both "title" and desc.
Also, not sure if you realized or not, you can combine multiple paints using the provided CompositePaint class.
Thanks for being the first user! Your feedback is appreciated.
-Jonathan
Re: SVG - Action with javascript
Sorry for resuming an old thread. I have tried the same thing, i.e. adding tooltip to a SVG pie chart, but it doesn't work. I think I'm missing something. Until now I have set custom colors for the sections, in this way:
Now, if I replace this code and I add the tooltipPaint, the color is not set any more!
So, how to have both?
Code: Select all
pie.setSectionPaint(k,colors[i]);
Code: Select all
pie.setSectionPaint(k,new cTooltipPaint("test", "desc"));