cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kieran Kirwan" <KKir...@dto.ie>
Subject RE: Dynamic SVG creation
Date Mon, 09 Feb 2004 12:48:56 GMT
Hi Robby,

I use a combination of 
 - XSP database queries
 - dynamic SVG generation using the MSXMLDOM and Javascript.
I generally find it easier to write scripts than to use XSL for the SVG generation.
For example the function below will load XSP data to a template SVG:

---------------------------------------
function addCentroids()
{
var xml1 = new ActiveXObject("Microsoft.XMLDOM"); xml1.async = false;
datapage="http://10.0.0.27:8080/cocoon/mod06001/content/page5.xsp";
xml1.load(datapage);
dataNodes = xml1.getElementsByTagName("zone");
//
var svgdoc=document.svgMap1.getSVGDocument();
var svgRoot=svgdoc.documentElement;
newGroup=svgdoc.createElement("g");
newGroup.setAttribute("id","centroids");
newGroup.setAttribute("class","centroid");
svgRoot.appendChild(svgdoc.createTextNode("\n"));
for (i=0; i<dataNodes.length; i++)
{
newGroup.appendChild(svgdoc.createTextNode("\n"));
	newCentroid=svgdoc.createElement("circle");
	newCentroid.setAttribute("id",dataNodes.item(i).getAttribute("id"));
	newCentroid.setAttribute("cx",dataNodes.item(i).getAttribute("cx"));
	newCentroid.setAttribute("cy",dataNodes.item(i).getAttribute("cy"));
	newCentroid.setAttribute("r","5");
	newGroup.appendChild(newCentroid);
}
svgRoot.appendChild(newGroup);
svgRoot.appendChild(svgdoc.createTextNode("\n"));
}

_____________________________________________
Kieran Kirwan
Executive Transportation Planner
Transportation Modelling Department
 
Dublin Transportation Office
Hainault House,
69/71 St. Stephen's Green,
Dublin 2,
Ireland.
Tel: +353 (0)1 4778113
Fax: +353 (0) 1 478 5935
website: www.dto.ie <http://www.dto.ie/>  
 



-----Original Message-----
From: robby.pelssers@vodafone.com [mailto:robby.pelssers@vodafone.com]
Sent: 09 February 2004 12:41
To: users@cocoon.apache.org
Subject: Dynamic SVG creation


Hi,


I have already experimented with SVG for dynamically creating images and
graphs.  At the moment i write a servlet (xsp) that generates (dynamically)
an XML-file which I use as input for the appropiate stylesheet (xsl) to
generate an SVG file.  I was wondering if that's the only way to do this and
if it's the best way.  Who uses batik and how do you implement it in your
portal?  

Robby Pelssers

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
Mail Marshal for the presence of computer viruses.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message