Module:Chart/doc: Difference between revisions

Content deleted Content added
remove redundancy
Why would an outdated extension with security issues have been more suitable?
 
(20 intermediate revisions by 12 users not shown)
Line 1:
{{high-use|850}}
{{Template display|badmobile}}
Module Chart exports two functions: bar chart and pie chart
 
Line 38 ⟶ 40:
|-
| {{nowrap|group names}} || names of different groups
|-
| {{nowrap|y tick marks}} || number of tick marks on the y axis. if the value is negative or omitted, the module will attempt to automatically calculate a sensible number of tick marks.
|}
 
==Display in the mobile view==
Bar charts behave unpredictably, causing problems with the axes and legend. Use [[Template:Graph:Chart]] instead. {{dubious span |date=July 2023 |Pie charts aren't too bad.}}
 
===Examples===
Line 106 ⟶ 113:
 
====Scale per group====
It is possible to show each of the groups using different scale and units:
 
<pre>
{{ #invoke:Chart | bar chart
| width = 800
| group 1 = 1500000 : 2500000 : 3500000
| group 2 = 200 : 5000 : 45000
| group 3 = 2000 : 5000 : 20000
| colors = red : blue : green
| group names = People : Cars : Average car cost
| x legends = 1920 : 1965 : 2002
| tooltip 2 = : There is no good data for number of cars in 1965. we use 5,000 as best estimate
| units prefix = : : $
| scale per group = 1
}}
</pre>
 
{{ #invoke:Chart | bar chart
| width = 800
| group 1 = 1500000 : 2500000 : 3500000
| group 2 = 200 : 5000 : 45000
| group 3 = 2000 : 5000 : 20000
| colors = red : blue : green
| group names = People : Cars : Average car cost
| x legends = 1920 : 1965 : 2002
| tooltip 2 = : There is no good data for number of cars in 1965. we use 5,000 as best estimate
| units prefix = : : $
| scale per group = 1
}}
 
Notice the "units prefix" field: we do not need prefix for the first 2 groups, so we use colons with no content. As whitespace is ignored, we could write "::$" instead of " : : $".
 
Also note the special tooltip for the "Cars" number for 1965.
 
 
This option has been disabled. It was rarely used and broke in the last code update.
Here is an example with large number of groups - mainly to test how it looks with large number of legends:
 
Line 268 ⟶ 242:
 
===Examples===
 
<pre>
{{#invoke:Chart|pie chart
Line 280 ⟶ 255:
| percent = true
}}
</pre>
 
Note that we can leave the color empty to use the default, but in order to add the link to "Pear",
we had to mark the parameter by adding an extra delimiter to mark the omitted color parameter
 
Also note that the values can be provided with "language specific" format (like 1,000),
or scientific notation like 6.4e5. In the legends, numbers will always be displayed in
language-adjusted mode (can look different if module imported to other wikis).
</pre>
{{#invoke:Chart|pie chart
| radius = 150
Line 299 ⟶ 268:
| percent = true
}}
 
 
An example for the alternative syntax with "slice 1", "slice 2" etc.
 
<pre>
Line 368 ⟶ 334:
| percent = true
}}
<noinclude>
[[Category:Module documentation pages]]
</noinclude>