> From: Phillip Larsen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 19, 2002 2:09 PM
> To: 'Batik Users'
> Subject: Getting hold of Document used in SVGGeneratorContext and
> SVGGraphics2D
>
>
> Hi, I am creating a web charting application using Batik.
>
> I create a Document by first creating a DOMImplementation and
> then using this DOMImplementation to create the Document.
>
> The Document is used to create a SVGGeneratorContext object and then
> the SVGGeneratorContext is used to create the SVGGraphics2D object.
>
> I then use this SVGGraphics2D object as the graphical context in the
> charting component. I am assuming that the Document I created is used
> to hold the DOM tree created when performing Java2D commands with the
> SVGGraphics2D object as graphical context.
>
> The charting component contains Java2D commands to create a simple line
> chart where the lines for each series of data are connected with circles,
> i.e. each value in the line chart is marked by a circle.
>
> I want to be able to perform drill down on this chart by clicking on the
> circles to retrieve more information. Thus I need to be able to make the
> circles in the chart clickable. To do so I think I need to go through
> the DOM tree for the chart and replace each circle element with an X-link
> element where the cirle is a child element of the X-link element.
>
> Here is the code I am using to perform what I have described above :
> [...]
I am investigating on possible bugs in Batik but I already have some hints
to enhance your code:
- the namespaces are not correctly set on your elements:
'<a>' should be in the SVG namespace,
'xlink:href' should be in the Xlink namespace,
'fill' should be in the null namespace (because SVG attributes are not
in the SVG namespace),
- the element assigned to the 'circle' variable is a 'rect' element !! (it
can explain why nothing happen...),
- it is very dangerous to use the list returned by
getElementByTagName[NS]() when you modify the DOM tree because these lists
are live: it means that when a <circle> is added to the DOM, the list is
updated and the circle element is added to the list, at a position depending
on its position in the DOM tree.
--
Stephane.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]