]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/postsparkline.mdwn
web commit by http://ptecza.myopenid.com/: * Question about nested plugins
[ikiwiki.git] / doc / plugins / postsparkline.mdwn
1 [[template id=plugin name=postsparkline author="[[Joey]]"]]
2 [[tag type/chrome]]
3
4 This plugin uses the [[sparkline]] plugin to create a sparkline of
5 statistics about a set of pages, such as posts to a blog.
6
7 # examples
8
9         Post interval: 
10         \[[postsparkline pages="blog/* and !*/Discussion" max=100
11         formula=interval style=bar barwidth=2 barspacing=1 height=13]]
12         
13         Posts per month this year: 
14         \[[postsparkline pages="blog/* and !*/Discussion" max=12
15         formula=permonth style=bar barwidth=2 barspacing=1 height=13]]
16
17 # usage
18
19 All options aside fron the `pages`, `max`, and `forumla` options are passed
20 on to the sparkline plugin.
21
22 You don't need to specify any data points (though you can if you want to).
23 Instead, data points are automatically generated based on the creation
24 times of pages matched by the specified `pages` [[PageSpec]]. A maximum of
25 `max` data points will be generated.
26
27 The `formula` parameter controls the formula used to generate data points.
28 Available forumlae:
29
30 * `interval` - The height of each point represents how long it has been
31   since the previous post.
32 * `perday` - Each point represents a day; the height represents how
33   many posts were made that day.
34 * `permonth` - Each point represents a month; the height represents how
35   many posts were made that month.
36 * `peryear` - Each point represents a day; the height represents how
37   many posts were made that year.
38
39 # adding formulae
40
41 Additional formulae can be added without modifying this plugin by writing
42 plugins that register functions in the
43 `IkiWiki::Plugin::postsparkline::formula` namespace. These functions will
44 receive on input a reference to a hash of parameters, and a sorted list of
45 pages (newest pages first), and should return a list of data points for
46 the sparkline plugin.