]> sipb.mit.edu Git - ikiwiki.git/blob - doc/ikiwiki/directive/sparkline.mdwn
Merge branch 'master' into sipb
[ikiwiki.git] / doc / ikiwiki / directive / sparkline.mdwn
1 The `sparkline` directive is supplied by the [[!iki plugins/sparkline desc=sparkline]] plugin.
2
3 This directive allows for embedding sparklines into wiki pages. A
4 sparkline is a small word-size graphic chart, that is designed to be
5 displayed alongside text.
6
7 # examples
8
9         \[[!sparkline 1 3 5 -3 10 0 width=40 height=16
10         featurepoint="4,-3,red,3" featurepoint="5,10,green,3"]]
11
12 This creates a simple line graph, graphing several points.
13 It will be drawn 40 pixels wide and 16 pixels high. The high point in the
14 line has a green marker, and the low point has a red marker.
15
16         \[[!sparkline 1 -1(red) 1 -1(red) 1 1 1 -1(red) -1(red) style=bar barwidth=2
17         barspacing=1 height=13]]
18
19 This more complex example generates a bar graph. 
20 The bars are 2 pixels wide, and separated by one pixel, and the graph is 13
21 pixels tall. Width is determined automatically for bar graphs. The points
22 with negative values are colored red, instead of the default black.
23
24 # usage
25
26 The form for the data points is "x,y", or just "y" if the x values don't
27 matter. Bar graphs can also add "(color)" to specify a color for that bar.
28
29 The following named parameters are recognised. Most of these are the same
30 as those used by the underlying sparkline library, which is documented in
31 more detail in [its wiki](http://sparkline.wikispaces.com/usage).
32
33 * `style` - Either "line" (the default) or "bar".
34 * `width` - Width of the graph in pixels. Only needed for line graphs.
35 * `height` - Height of the graph in pixels. Defaults to 16.
36 * `barwidth` - Width of bars in a bar graph. Default is 1 pixel.
37 * `barspacing` - Spacing between bars in a bar graph, in pixels. Default is
38   1 pixel.
39 * `ymin`, `ymax` - Minimum and maximum values for the Y axis. This is
40   normally calculated automatically, but can be explicitly specified to get
41   the same values for multiple related graphs.
42 * `featurepoint` - Adds a circular marker to a line graph, with optional
43   text. This can be used to label significant points.
44   
45   The value is a comma-delimited list of parameters specifying the feature
46   point: X value, Y value, color name, circle diameter, text (optional),
47   and text location (optional). Example: `featurepoint="3,5,blue,3"`
48   
49   Available values for the text location are: "top", "right", "bottom", and
50   "left".
51
52 [[!meta robots="noindex, follow"]]