Template:Dot chart/doc

From English Wikipedia @ Freddythechick

Usage

This template is used to produce a Dot graph/Dot plot/Scatter plot.

There are two ways of using this template (Usage A is for scatter plots whereas Usage B is for Dot graphs/Dot plots):

  • Usage A (|x...|y...): It takes a x input (0-100) then a y input (0-100) and so on <syntaxhighlight lang="wikitext" inline>The amount of x values (5) is more then the number y values (4)</syntaxhighlight>
  • Usage B (|dots=|y...): It takes dots = number of dots per columns <syntaxhighlight lang="wikitext" inline>Lua error in Module:Dot_chart at line 63: attempt to perform arithmetic on a nil value.</syntaxhighlight>
  • Example: <syntaxhighlight lang="wikitext" inline>
    </syntaxhighlight> ≈ <syntaxhighlight lang="wikitext" inline>
    </syntaxhighlight>
  • Note: cols + rows should equal the number of values that follow
  • Note: Usage B almost always has more precision then Usage A
  • Note: x inputs are from 0-100 and y inputs are from 0-100

This template also takes a variety of other parameters:

  • |color-#= The template can take a color input for each do that is color-dot number (The default color is red) (overrides color-even and color-odd)
  • |legend-color= This template can take a legend input to add to the legend.
  • |x labels= The labels to show along the x axis separated by commas (,) (label1,label2,label3)
  • |align= The alignment of the chart (default right)
  • |color= The background color (default none/transparent)
  • |border= Whether of not to show the border (default yes)
  • |yx= Take y then x instead of x then y (default no)
  • |color-even= Sets every other dot to a specific color (default red)
  • |color-odd= Sets every odd dot to a specific color (default red)
  • |square= Makes the chart/plot a square (default no)
  • |width= The width of the chart
  • |picture= The picture for the background of the chart, excluding File: or Image: (default Blank.png)
  • |size= The size of the dots (default 8px)
  • |bottom= Text tho show on the bottom of the template
  • |top= The header to show on top of the graph

Examples

Dot graph/chart

<syntaxhighlight lang="wikitext">

Sales
a
ab
abc
abcd
abcde
0
10
20
30
40
50
(red) = Big Co.
(green) = Small Inc.
Big companies has more sales, in the year of abcd, the industry has a spike.

</syntaxhighlight>

Sales
a
ab
abc
abcd
abcde
0
10
20
30
40
50
(red) = Big Co.
(green) = Small Inc.
Big companies has more sales, in the year of abcd, the industry has a spike.

Scatter plot

<syntaxhighlight lang="wikitext" inline>

Random Dots
10
20
30
40
50
60
70
80
90
100
0
10
20
30
40
50
60
70
80
90
100

</syntaxhighlight>

Random Dots
10
20
30
40
50
60
70
80
90
100
0
10
20
30
40
50
60
70
80
90
100

Error messages

<syntaxhighlight lang="wikitext" inline>The amount of x values (6) is more then the number y values (5)</syntaxhighlight> The amount of x values (6) is more then the number y values (5)


<syntaxhighlight lang="wikitext" inline>The amount of x values (5) is less then the number y values (6)</syntaxhighlight> The amount of x values (5) is less then the number y values (6)


<syntaxhighlight lang="wikitext" inline>The amount of y parameters (7) ÷ parameter dots (2) is not a integer (3.5)</syntaxhighlight> The amount of y parameters (7) ÷ parameter dots (2) is not a integer (3.5)