BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XSLT
XPath as parameters
Table with more than one column
Create an N-Column Table from XML node-set
Finding ""the corresponding node"" in a parallel subtree
Get the last item from a delimited list
Limitation to Muenchian method.
Find the number of tokens or words in a string
Randomization of node-sets or node-lists
XPath Analyzer
Finding the Maximum Date
World Cup 2002 fever hits XSLT!!
Using XSLT for DHTML Menus
RSS / RDF Newsfeed Reader
Hierarchical menu from Database + XSL to Html
XSLT syntax hightlighter
XSLT Stylesheet for listing namespaces used in a document
Rotate an SVG shape over it's center
Looping through each letter of the alphabet
An XSL Calculator using the FXSL Functional Programming Library
A Calendar, using the XSelerator's datetime library


 
 

<< XQuery.NET and XML >>


By Martin Rowlinson (aka Marrow)
First Posted 03/13/2002
Times viewed 208

Using XSLT to produce SVG (3)


This post contains attachments
v20020313183135.zip 

Summary Using XSLT to produce a simple pie chart from XML data.

To try this code in Xselerator, please install the 30 day demo version of MarrowSoft Xselerator.

I must confess - I think SVG is one of the greatest things since sliced bread! :-)

Combining the power of SVG with the capabilities of XSLT to produce dynamic graphics (e.g. graphs) from XML data is truly excellent - we just need to wait for SVG to be more widely supported by browsers (by default - at the moment it can only be done with the use of plug-ins, e.g. the Adobe SVG Viewer http://www.adobe.com/svg/viewer/install/main.html).

So I've been having a play with using SVG in combination with XSLT to produce some very rudimentary graphs and charts - this time it is the turn of the good old pie chart.  I'm no SVG whiz so my SVG code may not be the best - and I'd appreciate comments if any experts out there can see that my SVG coding is way off beam!

The one thing that surprised me in SVG was the lack of the ability to specify arcs - without having to calculate the arc start and end positions.  It would have been a lot nicer if arcs could be somehow specified by the center, angle and radius - or maybe I just missed something???

I have tried to make the actual template that draws each pie segment as isolated as possible - so this should be, to some degree, easily re-usable (feel free to lift it and make use of it in your own systems).

Anyway, my rudimentary attempts are shown below - do let me know what you think.
NOTE: The full code (with included xsl library and example XML data is included in the source zip).  Many thanks to Dimitre Novatchev for allowing me to use, in advance of its release, his trig library.

Cheers - Marrow
http://www.MarrowSoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.TopXML.com/Xselerator

 

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XQuery.NET and XML >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML