grapher

Welcome to Graph Help

What can this thing do?

See the Examples page.

How do I use it?

You can add the graph to a web page by using an <img> tag, or a special <div>; chances are you will need both.

If you want to use an animated "client side" graph (for example, using the Fusion graphing backend), you need to use the <div> mechanism. If you want to get a graph in a non-javascript environment (say, when passing to the PDF generator), you need to use the <img> tag method.

The div mechanism looks like this:

	<div class='grapher'>
		<div class='data'>({base: "graph/t/b/w/300/....?apikey=1111222233334444"})</div>
	</div>

The <div> mechanism also requires a javascript library, so don't forget to include that; put something like this with your <head>:

	<script src="http://{graph service host}/GraphHandler/class/grapher" type="text/javascript">

The <img> mechanism looks like this:

	<img src="http://{graph service host}/graph/t/b/w/300....?apikey=1111222233334444"/>

In the case when you need to switch between the two, you can use some standard Knickers vanish tags, doing something like this:

{OUTPUT_MODE=Standard?:|VANISH|}
<div class='grapher'>...</div>
{/OUTPUT_MODE=Standard?:|VANISH|}
{OUTPUT_MODE=Standard?|VANISH|}
<img src="...."/>
{/OUTPUT_MODE=Standard?|VANISH|}

And here are the available variables:

var namedescriptionrequired
t Chart type.
valuedescription
bbar (defaults "grouped" vertical; bh for horizontal, but not all backends support this)
ppie; add "h" for hole (doughnut), add "3" for 3D. (not all backends support 3D doughnut.)
lline
rradar; add "s" for smoothed line (not all backends supported)
Note: To make the line "close the loop", send the first datapoint again at the end of the list.
yes
wwidth (pixels)yes
hheight (pixels)yes
dData. Comma-sep list.yes
l (lower L)Label. Comma-sep list.no
bGraphing backend. Currently, Google is the currently the default.no
ssSettingSet name -- used for pre-configured settings, like palettesno
cColors. Comma-sep list of hex (i.e., e9e39f,fff,000000); overrides the palette in the SettingSet.no
bgcBacground color, in hex (i.e., e9e39f).no
mMarkers. Specify "s" to show a shape marker at at the data point. Specify "v" to show the value. Or both. "s" is used by default on line graphs; to not show, send something other than "s".
fFormat Y-Axis labels. "h", "g", "i", "s" will be translated to hours (with leading zeros), hours (without leading zeros), minutes, and seconds, respectively. Additionally, two special formats are considered; "x" is the value, "p" for percent sign.
Examples:
inputformatoutput
129660h:i:s36:01:00
120i:s02:00
120xp120%
120$x$120
rRange (x-axis); auto-range by default. Format is min,max. To emulate old behavior where graphs normally always started at 0, send "0" or "0," for r.no
nGraph title ("name")no
glShow gridlines. Defaults to 1 (on); send 0 to turn them off.no
axShow axis. Defaults to 1 (on); send 0 to turn them off.no
sMaximum number of values to show (0 is all)no
hrDraw a horizontal rule at the given value, or "a" for the average value.no
sdTop N ("t")[default], Bottom N ("b"), Top/Bottom ("tb")no
sb(1/0) Show/Hide the avg bar for the rest of the values (only works in bar mode)no

There is some limited support for legends, but only on the Google backend at the moment. For a single bar, use the "k" parameter; for a multi-type, use k0 - kx. There are no controls over how it is displayed.