Hi Olivier, Olivier Terral <[email protected]> wrote on 01/27/2009 09:45:56 AM:
> I 've transformed a JFreeChart in SVG with Batik without problem but I need > to add some javascript events (onmousover, onmouseout ..) on SVG elements > to make the Chart more dynamic and beautiful. > > The problem is the SVG generated by Batik has no informations (ids or > attributes) about which part of the graph he refere . > > Is it possible to add some ids when the SVG is generated ? At any point you can get the current contents of the SVG generator by calling 'getRoot'. So if you can insert code into the drawing process for JFreeChart you can call getRoot before and after each important 'piece' of the graph. You can then set an ID attribute on the returned element and append that subtree to your own document. Note that getRoot clears the current contents of the Graphics2D. Also you may find that it's best to call getRoot with your own 'container' SVG Element (like an SVG 'g' (group) element). > or does it exist a mapping or something like that to find which SVG elements > corresponding to which part of the graph? I think the above is your best bet.
