Extension:Plotters

Special:Plotters
The list of available plotters is defined on MediaWiki:Plotters-definition. Plotters defined there can be used in or  calls. An overview of the plotters defined by MediaWiki:Plotters-definition is also shown on Special:Plotters, along with links to the respective system messages, for easy editing.

Each line in MediaWiki:Plotters-definition that starts with one or more "*" (asterisk) characters defines a plotter; it must have the following form:

* myplotter|myplotter.js

That is, each line consists of fields separated by a "|" (pipe) character. The first field ("myplotter" in the example) is the plotters internal name, and references a system message (MediaWiki:Plotter-myplotter in the example) that contains a short description of the plotter, using wiki syntax.

The internal name must start with a ASCII letter, and must contain only ASCII letter and numbers!

The remaining fields on the line refer to the JavaScript code that makes up the plotter, contained in system messages (MediaWiki:Plotter-myplotter.js in the example); the names of those messages must end with ".js". A plotter can use any number of code messages, specifically, common code can be put into a code message used by several plotters, in addition to their own specific code, e.g:

* bar|commonStuff.js|bar.js * pie|commonStuff.js|tools.js|pie.js

The list of plotters in MediaWiki:Plotters-definition can be broken into sections using lines that start and end with two or more "=" (equals) characters, enclosing the name of a system message that defines the section's name - for example:

== plotkit-scripts ==

This would define a new section, with the title defined on the page MediaWiki:Plotter-section-plotkit-scripts

Arguments

 * name : A name for the plot. This is required for multiple plots in the same article. Only alpha-numeric characters are allowed, and only up to 255 characters; no default
 * renderer : The type of renderer to use; only plotkit and generic are available currently; the default is plotkit
 * width : A greater than zero number in pixels to modify the width of the canvas; the default is 300
 * height : A greater than zero number in pixels to modify the height of the canvas; the default is 300
 * script : The plotter script to use. This is the script used to draw on the canvas. Only alpha-numeric characters are allowed, and only up to 255 characters; no default
 * scriptarguments : A comma delimited list of arguments to be sent to the script. Commas that need to be sent as an argument can be escaped with a \. ; no default
 * preprocessors : A comma delimited list of preprocessors. These will be called in order, and can be used to modify data and labels before the plotter script is called. Only alpha-numeric characters are allowed, and only up to 255 characters per preprocessor; no default
 * preprocessorarguments : a comma and colon delimited list of arguments to pass to the preprocessors; no default
 * datasep : The delimiter for the data; the default is ,
 * labels : A comma delimited list of labels for the data. Only alpha-numeric characters are allowed, and only up to 255 characters per label; no default
 * tableclass : The CSS class used for the javascript fallback table. Only alpha-numeric characters are allowed, and only up to 255 characters; the default is wikitable

Scripts and preprocessors
Preprocessing scripts, and plotting scripts are available, and the javascript function for each should be defined as follows:

You can use these in a parser function like so:

Requirements

 * PlotKit, if the plotkit renderer is to be used
 * MochiKit is a requirement for PlotKit

Installation

 * 1) Download the extension from the above link
 * 2) Download PlotKit and MochiKit and place them in a web-server retrievable directory of your choosing; they must be in the same directory, and the directories must be named "mochikit" and "plotkit". The directory names must be lowercase. The javascript files for these libraries must be directly under these directories.
 * 3) Add the following lines to the end of LocalSettings.php:
 * require_once( "$IP/extensions/Plotters/Plotters.php" );
 * $wgPlottersJavascriptPath = "/scripts"; //the extension will look for /scripts/mochikit and /scripts/plotkit

Plokit scripts for use

 * /Plotkit scripts