Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Wnt/Plotter/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Module rating|pre-alpha}} 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 <code>right</code>, as with image files. To make the chart appear on the ''left'' side of the page, specify <code>thumb=left</code>. * "caption" is a string of text that appears on a line just before the legend. * option "<code>other</code>", if specified, will cause an "Other" item to appear in the legend. ''(don't know if I implemented that)'' * each "label''N"'' 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 "value''N"'' 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 "color''N"'' is a [[Web colors|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. {{#invoke:Sandbox/Wnt/Plotter|piechart |radius=150 |other = yes |value1 = 1 |label1 = One |value2 = 32 |label2 = Two |value3 = 12 |label3 = Three |value4 = 3 |label4 = Four |value5 = 2 |label5 = Five |value6 = 1 |label6 = Six |value7 = 3 |value8 = 7 |value9 = 2 |value10 = 3 |value11 = 1 |value12 = 4 |value13 = 7 |value14 = 1 |value15 = 1 |value16 = 3 |value17 = 3 |value18 = 3 |value19 = 2 }} {{#invoke:Sandbox/Wnt/Plotter|piechart | caption=[[Religion in the Czech Republic]] as of 2001. | other = yes | label1 = [[Atheist]]s and [[Agnosticism|agnostics]] | value1 = 59 | color1 = silver | label2 = [[Catholic Church|Catholics]] | value2 = 26.8 | color2 = #008 | label3 = [[Protestantism|Protestants]] | value3 = 2.5 | color3 = #08f }} ===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.)
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Greater color contrast ratio
(
edit
)
Template:Legend
(
edit
)
Template:Legend/styles.css
(
edit
)
Template:Module rating
(
edit
)
Module:Chart/Default colors
(
edit
)
Module:Color contrast
(
edit
)
Module:Color contrast/colors
(
edit
)
Module:Sandbox/Wnt/Plotter
(
edit
)