पटलम्:Plotter/doc
यह पटलम्:Plotter हेतु प्रलेख पृष्ठ है
This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
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"
सम्पादयतु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, specifythumb=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.
function "main"
सम्पादयतु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"
सम्पादयतु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.)