Demographic / population pyramid graph applet (v1.0)
Centre for Computational Geography
University of Leeds
This Applet displays an arbitary number of pyramid graphs, sometimes known as
"population pyramids" or "demographic pyramids". The pyramids have a scrollbar that
can be used to run through different datasets. Usually with demographic pyramids these
datasets would be changes over time.
To use the applet, you'll need the archive file pyramidgraph1_0.jar, and
a data file for each side of a pyramid you want. The files used for the
example are female.csv
and male.csv. If you include more files, the applet will grow more
pyramids next to each other, with the same vertical scale, starting with a left hand graph, followed
by an associated right hand graph (you can, of course, add the same file several times if you
want to see this).
Data files should be comma or space separated tables. The first line
should be a label for the file (unused), then labels for the bars.
Only the labels from the first file are used, but they should be identically
present in all files. Subsequent lines should be a label for that
dataset and then values for the bars. Again, only the labels in the first
file will be used, but the labels should be the same in all files.
The scrollbar will go between the first and last labels (which will be
shown), and the current scrollbar value will be shown as a label
(labelPrefix + current label). If this is confusing, run though it with the example
and the first example datafile.
Look at the source code of the example to see how to broadly set up the applet. The
details are given for an applet set up with the archive, webpage and data files in the
The PARAM tags control the applet, and can be used as follows (default values given)...
<PARAM name="numberOfFiles" value="0">
The number of files to be read.
<PARAM name="file1" value="filename">
The first file to be read, subsequent PARAMs should be named
<PARAM name="colour1" value="#ffffff">
The colour to colour the boxes for file1, subsequent PARAMs should be named
colour3 etc. Note the UK spelling. Colours should be a hash
followed by a standard web hex colour representation.
<PARAM name="foreground" value="#000000">
The colour for lines and text.
<PARAM name="background" value="#ffffff">
The background colour for the Applet. The scrollbar will have the same
background, only lighter/darker depending on colour.
<PARAM name="labelPrefix" value="">
Text to be prefixed to the scrollbar label. In the example this is "Present=".
<PARAM name="barHeight" value="10">
Height of bars in the graph.
Note that any number of files can be shown. They will pair up in the order given. Single files remaining will show as bargraphs. Note
also that the height of the Applet vs. the barHeight PARAM fixes the gap between the bars. If you don't want gaps, set the Applet
This applet may be freely used by academic and non-profit, non-governmental organisations,
as well as private individuals. Other organisations should contact the CCG for information on its use.
For further information about this applet and the source code, contact
Dr Andy Evans.
[School of Geography homepage]