NAME

Kwiki::GDGraphGenerator - put pretty graphs into your Kwiki pages

SYNOPSIS

$ cd /path/to/kwiki
$ kwiki -add Kwiki::GDGraphGenerator

In your KwikiText:

.graph
id: test
type: pie
data:
  - [ bacon, eggs, ham, home fries, hash ]
  - [ 1,     4,    2,   3,          2    ]
.graph

DESCRIPTION

This module turns graph WAFL blocks into pretty graphs using GD::Graph. Between the .graph directives must be valid YAML. Some keys are required.

Keys

  • id - REQUIRED, must be unique for every page, must be valid characters in a filename. Examples: sales or marmots.

  • type - REQUIRED, the type of graph, will be prepended with "GD::Graph::" to determine which GD::Graph module to use

  • data - REQUIRED, the data set. See "Examples" below.

  • width and height, defaults are both 300 (pixels).

  • title, text title of the graph

  • x_label and y_label, axis labels

  • ...and any other options you can find in "OPTIONS" in GD::Graph.

Examples

.graph
id: orangejuice
type: bars
title: Gallons of OJ I Drank This Week
x_label: Day of Week
y_label: No. of Gallons
shadow_depth: 2
data:
  - [ Sun, Mon, Tue, Wed, Thu, Fri, Sat ]
  - [ 23,  12,  43,  3,   16,  18,  30   ]
.graph

.graph
id: lines
type: lines
line_width: 3
show_values: 1
data:
  - [ 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ]
  - [ 1, 4, 2, 3, 6, 4, 2, 5, 6, 7 ]
  - [ 3, 5, 1, 1, 6, 8, 4, 6, 2, 4 ]
  - [ 3, 5, 9, 2, 5, 6, 3, 1, 7, 7 ]
.graph

.graph
id: test
type: pie
width: 500
height: 200
dclrs: [ red, green, blue, yellow, purple, cyan, orange ]
data:
  - [ bacon, eggs, ham, home fries, hash ]
  - [ 1,     4,    2,  3,  2 ]
.graph

CAVEATS

You might need to clean up the cache for this module every now and then. The cache is located in the plugin/graphgenerator directory in your Kwiki installation directory.

The "logo" key is not allowed because it would allow anyone to view any image on the filesystem that the Kwiki user could read.

AUTHORS

Ian Langworth <langworth.com>

SEE ALSO

Kwiki, GD::Graph, GD::Graph::colour

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Ian Langworth

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.