]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/postsparkline.mdwn
web commit by tschwinge: *Preview* when creating new pages.
[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`, `formula`, `time`, and `color`
20 options are passed 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 The `time` parameter has a default value of "ctime", since forumae use
40 the creation times of pages by default. If you instead want
41 them to use the modification times of pages, set it to "mtime".
42
43 To change the color used to draw the sparkline, use the `color` parameter.
44 For example, "color=red".
45
46 # adding formulae
47
48 Additional formulae can be added without modifying this plugin by writing
49 plugins that register functions in the
50 `IkiWiki::Plugin::postsparkline::formula` namespace. These functions will
51 receive on input a reference to a hash of parameters, and a sorted list of
52 pages, and should return a list of data points for the sparkline plugin.