>>>>> "DS" == David Smith <[EMAIL PROTECTED]> writes:

DS> I have a graph making tool in batik and am trying to center the
DS> created graph on the JSVGCanvas by applying a translate function.
DS> However I cannot get it to work.

DS> My code is similar to:

DS> SVGDocument graph = GraphBuilder.createGraph(..)

DS> canvas.setSVGDocument(graph);

DS> // calculate translation co-ordinates, x and y..

DS> AffineTransform at = new AffineTransform() at.translate(x,y); //
DS> translate to the correct position

DS>  if(canvas.getRenderingTransform() != null)
DS> at.concatenate(canvas.getRenderingTransform());
DS> c.setRenderingTransform(at);


DS> This has no effect at all on the graph, though if I call the same
DS> transform function from a menu item once the graph is loaded, it
DS> works fine.  Does anyone have any idea?  Is there a better way of
DS> performing the translation (eg setting an x/y offset on the
DS> canvas)?

    You probably want to look at the viewbox and width and height
attributes on the SVG element in the SVG specification.  Unless you
are trying to do something much more complicated than I think you are
you should be able to get the behaviour you want by setting these
attributes appropriately for the Graph.

    The actual problem you are having is that you need to wait until
the 'internal tree' is built before trying to set the rendering
transform.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to