Note: now that this module's pie chart capability has been added to Module:Chart, this module is starting to look obsolete by comparison. It is therefore rated pre-alpha and not for general use, probably pending a total takeover by Module:Chart. It's being kept around only in case there are some functions left the latter hasn't matched yet, which I haven't checked.

This module has three plotting capabilities so far. Some of the code is crude as I began back when I'd first heard of Lua. They are all written independently and not even the parameters are standardized between them, nor do they share any subroutines. "Main" needs major work, "bar" is a bit better but not as good as Module:Chart at present, and "piechart" is closely based on Template:Pie chart.

function "piechart"

uredi

This uses the miter joining of border elements in HTML/CSS to draw pie-shaped slices. I still don't fully understand the code taken from Template:Pie chart but have made it a bit more comprehensible. The main improvement so far is that it is resizable and not limited to 10 slices.

New parameters are

  • Radius (default 100) - radius of the pie chart
  • nowiki - include a nonblank value to read rather than graph the output

To quote the piechart template

  • option "thumb" specifies which side of the page the chart is floated to and defaults to right, as with image files. To make the chart appear on the left side of the page, specify thumb=left.
  • "caption" is a string of text that appears on a line just before the legend.
  • option "other", if specified, will cause an "Other" item to appear in the legend. (don't know if I implemented that)
  • each "labelN" is a string of text that appears in the legend entry for a slice. Omitting it will cause a legend entry to not be shown for that slice.
  • each "valueN" is the percentage that the slice represents. Do not include the percent sign. (Need to fix that) Also note that it is shown in the legend as written (just after the label), without any rounding or other reformatting.
  • each "colorN" is a CSS color code or name. See Module:Plotter/DefaultColors for the default values. This can be overridden with:
  • "colorset" - specifies a Module: space file to get a list of color names and values

Note that the nowiki example given at the beginning of Template:Pie chart's documentation doesn't work, but it doesn't work for that template either. If there was ever some way to specify colors with numbers like 2 or 8, I think it's been forgotten.

 
  One (1%)
  Two (33%)
  Three (45%)
  Four (48%)
  Five (50%)
  Six (51%)
   (54%)
   (61%)
   (63%)
   (66%)
   (67%)
   (71%)
   (78%)
   (79%)
   (80%)
   (83%)
   (86%)
   (89%)
   (91%)
  Other (9%)
 
  Atheists and agnostics (59%)
  Catholics (85.8%)
  Protestants (88.3%)
  Other (11.7%)

function "main"

uredi

This is a demonstrative scatter plot function that doesn't even have labels added yet.

  • icon (an image to display at each point)
  • iconradius (default 10 - a rough measurement of the icon's size to help position dashed lines)
  • lineicon (cruddy text icon "•" - should be replaced by divs)
  • lineiconradius (default 5)
  • plotsizex (default 100)
  • plotsizey (default 100)
  • plotstep (default 10) distance between dashes
  • unnamed arguments are x and y coordinates of multiple points

function "bar"

uredi

This produces a bar chart. It has labels but I'm still working on the axis...

local delimiter = args.delimiter or pargs.delimiter or ","

  • width (default 200)
  • height (default 200)
  • normalize - a list of N numbers corresponding to data series 1 to N. Each number identifies which series a series should be normalized to. So "1 2 1 1 3" will plot series 1,4,5 relative to one another, but 2 and 5 will be on their own scale (with their own axis labels, eventually)
  • delimiter (default comma) separates values in group1, group2, etc.
  • group1, group2, group3 etc. Each is a list of numeric values separated by delimiter
  • xlegend - labels for each position on the x axis separated by delimiter. It is assumed all series use the same x values.
  • ylegend - labels for each series of data (group1, group2, etc.)

Ovo je stranica dokumentacije za Modul:Plotter