here my piece of code, :
public static void writeChart(ChartBean chartBean, Writer pw) throws
Exception {
if (chartBean.getChart() != null) {
DOMImplementation domImpl = GenericDOMImplementation
.getDOMImplementation();
Document document = domImpl.createDocument(null, "svg",
null);
SVGGraphics2D svgGenerator = new
SVGGraphics2D(document);
chartBean.getChart().draw(svgGenerator, new
Rectangle2D.Double(0, 0,
chartBean.getWidth(), chartBean.getHeight()), null);
svgGenerator.stream(pw, false);
}
}
As you see the chart is draw with a svgGenerator in parameter so I've no
power to know or to modify the creation of SVG Elements in the function
draw().
So I think you're right I need to modify the JFreechart source code to
generate my own SVG like I want.
and it's exactly what I don't want to do :D
Thanks to try to help me
Bye
thomas.deweese wrote:
>
> 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.
>
>
--
View this message in context:
http://www.nabble.com/jFreeChart-%2B-batik-%2B-Javascript-tp21686678p21708368.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]