SVG, XSLT and JSP/JSTL: Generating Digital Gauge or Speedometer Chart based on dynamic data

Lucas Jellema 4

Speed-o-meter or Digital Gauge - Salary Sum per Department

Display SVG document in web-page

To display the SVG document in a webpage, it needs to be included through an <object>tag. I use the following JSP EmpReport.jsp:

<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Department Salary Report</title>
  <h1>Report on Departments and Salaries</h1>
    width="860" height="800" type="image/svg+xml">
    Sorry, your browser does not support SVG images; please download and install a
    plugin for SVG, for example at
    <a href=""></a>


Features for the Speed-o-meter Chart

The following features are supported:

  • Multiple Datasets with each a color and a label (as tooltip)
  • User defined markers and submarkers
  • Areas or zones with Color and Tooltips
  • User defined ‘gauge angle’ – semicircle, fullcircle etc.
  • Day-counter and counter with tooltip

Bar Chart

In a subsequent post I will discuss generation of barcharts. By the way, this is simpler than generating line-charts. A simple example of a barchart is the following:
Simple Bar-chart: salarysum per department


Creating SVG Pie Charts through XSLT via a Web Service by Paul Asman (Technical Specialist, Advanced Technology Center Federal Reserve Bank of New York);Excellent tutorial on the creation of SVG Pie Charts from XML data sources
Réaliser un histogramme en SVG (XSLT 1.0) Emmanuel Lazinier
PerfectXML: Common XSLT Tasks � Part I (Transformation and Sorting) – Transforming XML to SVG – Generating Sales Bar Chart
XML Extension Functions for XSLT Processing (Oracle9i XML Developer’s Kits Guide – XDK)
SVG Tutorial by Kevin Lindsey
Learn SVG Tutorial (especially Using XSLT to produce SVG (3)) by TopXML
SVGX.ORG – collection of links to interesting (and some less interesting) SVG resources
Database-Driven Charting Using XSLT and SVG and source code – also shows gridslines and value-markers on vertical axis
A Quantum Leap in Browser Graphics Capabilities by Vikas Pandya
Picture This: Web Interfaces Go Interactive Will combining graphical language capabilities with the flexibility of XML and XSLT make SVG mainstream? by Kurt Cagle – a demonstration of creating a Line Graph
Render dynamic graphs in SVG – Create SVG graphs that scale dynamically with their content Level: Introductory Brian Venn ( Software Engineer, IBM 29 Oct 2004
Steve Muench on MAX, MIN and AVG functions in XSLT
SVG Learning by Coding – large collection of annotated SVG example, including Bar Chart and Pie Chart
Instruction in Spanish on creating a Bar Chart
Examples of SVG based Dial Gauges (Speedometers); many more SVG examples: Many Sample Charts (barchart, barley, birdlog, cellular, fuelcalc, piecharts, polar, min-max, 3D charts and many more! (© Copyright Causeway Graphical Systems Ltd 2004)
Steve Muench’s collection of ADF examples, including one on using ADF BC writeXml() on ViewObjects in combination with JSTL XML tags; that one probably eliminates my use of the JSTL SQL library – that I do not like very much to begin with.

Enabling SVG in your browser

Note: to fully enjoy all parts of this post, you need an SVG renderer in your web browser, for example the Adobe SVG Plugin for Internet Explorer. To enable SVG viewing in Firefox on Windows – see Mozilla Plugin Support on Microsoft Windows, you need to download and install the Acrobat SVG Viewer Version 6.0 (beta); after installing the Adobe SVG viewer, Copy NPSVG6.dll and to your browser’s plugins folder. These files are normally located in C:Program FilesCommon FilesAdobeSVG Viewer 6.0Plugins

4 thoughts on “SVG, XSLT and JSP/JSTL: Generating Digital Gauge or Speedometer Chart based on dynamic data

  1. I can understand the report in PDF,XML,HTML.
    I want to do the report in XL.How I can proceed please give a idea.

  2. all information resides here are good.i need some information regardingg migration.i.e, can i get sorce code & front end design for migrating data from excel to oracle.reply soon…plz…

  3. I have drawn up a list of to do’s: new features I would like to add to the Speedometer chart:
    – animation (show the movement of the dials over time)
    – support for multiple axes
    – better markersupport: set markercolor, markerdash and markerlength; gridlines
    – display images (icons) as (part of) markervalues
    – display a legend indicating the meaning of each dial
    – implement a clock using the speedometer stylesheet as demonstration

    I hope to add these features in the new couple of weeks and update the post accordingly.

Comments are closed.

Next Post

Oracle 10g Discoverer Drake available for download

One of the Christmas presents from Oracle this year was the release of the 10g Business Intelligence tools. Most interesting among them was probably the long awaited Drake release of Oracle Discoverer. Mark Rittman’s weblog provides some details in this posts Oracle Business Intelligence 10g Available For Download and Taking […]
%d bloggers like this: