not sure if i sent it b4 subscribing... thanks...

Hi all,

 I am trying to create an SVG file that will have a graph that i can
display. i am using the DOM implementation as shown below to generate the
elements of the graph. Then i want to join them with the edges... but the
problem is that as u can see in the below code i have to give x, y
coordinates in the program and that is very very difficult when i want to
join two elements with an EDGE.

String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
            DOMImplementation impl = new SVGDOMImplementation();
            Document doc = impl.createDocument(svgNS, "svg", null);
            Element svgRoot = doc.getDocumentElement(); etc....


Element ellipse = doc.createElementNS(svgNS, "circle");
            ellipse.setAttributeNS(null, "cx", String.valueOf(xPoint));
            ellipse.setAttributeNS(null, "cy", String.valueOf(yPoint));
            ellipse.setAttributeNS(null, "r", "25");
            ellipse.setAttributeNS(null, "fill", "red");
            ellipse.setAttributeNS(null, "stroke-width", "2");

Element edge = doc.createElementNS(svgNS, "g");
        edge.setAttributeNS(null, "class", "edge");
        Element title = doc.createElementNS(svgNS, "title");
        title.setTextContent(node1Index + "&" + node2Index);

        Element path = doc.createElementNS(svgNS, "path");
        path.setAttributeNS(null, "style", "fill:none;stroke:black;");
        path.setAttributeNS(null, "d", "M"+edgeX1+" "+edgeY1+"L"+edgeX2+"
"+edgeY2);

as u can see in the code of path, i have to get x1,y1  and x2,y2 ... which
does not work.. is there a workaround for this???

I saw these classes in batik javadoc...  SVGEllipse, SVGPath .. can they be
used so i dnt have to give coordinates myself???
Actually i am runnig out of time for this one and so javadoc doesnt give me
idea.. can u pls give some input with example code so that i can achieve
this??

i ll really appreciate ur help...

thanks in advance..

nitya

Reply via email to