<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://thehillside.info/index.php?action=history&amp;feed=atom&amp;title=Module%3AGraph%2Fdoc</id>
	<title>Module:Graph/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://thehillside.info/index.php?action=history&amp;feed=atom&amp;title=Module%3AGraph%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Graph/doc&amp;action=history"/>
	<updated>2026-05-08T15:50:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2758&amp;oldid=prev</id>
		<title>Maintenance script: Protected &quot;Module:Graph/doc&quot; ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2758&amp;oldid=prev"/>
		<updated>2020-07-01T10:17:04Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/index.php/Module:Graph/doc&quot; title=&quot;Module:Graph/doc&quot;&gt;Module:Graph/doc&lt;/a&gt;&amp;quot; ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:17, 1 July 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key hillsideprod:diff:1.41:old-2419:rev-2758 --&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2419&amp;oldid=prev</id>
		<title>SheldonBole: 1 revision imported: Import Template:Graph:Chart</title>
		<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2419&amp;oldid=prev"/>
		<updated>2020-06-24T16:10:50Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported: Import Template:Graph:Chart&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:10, 24 June 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key hillsideprod:diff:1.41:old-2418:rev-2419 --&gt;
&lt;/table&gt;</summary>
		<author><name>SheldonBole</name></author>
	</entry>
	<entry>
		<id>https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2418&amp;oldid=prev</id>
		<title>en&gt;Pppery at 15:08, 19 April 2020</title>
		<link rel="alternate" type="text/html" href="https://thehillside.info/index.php?title=Module:Graph/doc&amp;diff=2418&amp;oldid=prev"/>
		<updated>2020-04-19T15:08:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Module with helper functions for the [[Extension:Graph|Graph]] extension.&lt;br /&gt;
&lt;br /&gt;
== Functions for templates ==&lt;br /&gt;
=== &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Creates a JSON object for &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;graph&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to display a political map with colored highlights. &lt;br /&gt;
&lt;br /&gt;
Maps can be found at [[Special:PrefixIndex/Module:Graph/]] and new maps should also be saved under Modul:Graph/.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Parameters:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;basemap:&amp;#039;&amp;#039;&amp;#039; sets the base map. The map definitions must follow the [https://github.com/mbostock/topojson/wiki TopoJSON] format and if saved in Wikipedia are available for this module. Maps in the default directory [[Special:PrefixIndex/Module:Graph/]] should only be referenced by their name while omitting the Module:Graph/ prefix to allow better portability. The parameter also accepts URLs, e.g. maps from other Wikipedia versions (the link should follow the scheme of &amp;lt;tt&amp;gt;//en.wikipedia.org/w/index.php?title=&amp;#039;&amp;#039;mapname&amp;#039;&amp;#039;&amp;amp;action=raw&amp;lt;/tt&amp;gt;, i.e. protocol-relative without leading http/s and a trailing action=raw to fetch the raw content only). &amp;lt;small&amp;gt;URLs to maps on external sites should be avoided for the sake of link stability, performance, security, and should be assumed to be blocked by the software or browser anyway.&amp;lt;/small&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;scale:&amp;#039;&amp;#039;&amp;#039; the scaling factor of the map (default: 100)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;projection:&amp;#039;&amp;#039;&amp;#039; the [[:en:map projection|map projection]] to use. Supported values are listed at https://github.com/mbostock/d3/wiki/Geo-Projections. The default value is &amp;lt;tt&amp;gt;equirectangular&amp;lt;/tt&amp;gt; for an [[:en:equirectangular projection|equirectangular projection]].&lt;br /&gt;
* ids of geographic entities: The actual parameter names depend on the base map. For example, for the above mentioned world map the ids are [[:en:ISO country codes|ISO country codes]]. The values can be either colors or numbers in case the geographic entities should be associated with numeric data: &amp;lt;tt&amp;gt;DE=lightblue&amp;lt;/tt&amp;gt; marks Germany in light blue color, and &amp;lt;tt&amp;gt;DE=80.6&amp;lt;/tt&amp;gt; assigns Germany the value 80.6 (population in millions). In the latter case, the actual color depends on the following parameters.&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;colorScale:&amp;#039;&amp;#039;&amp;#039; the color palette to use for the color scale. The palette must be provided as a comma-separated list of color values. The color values must be given either as &amp;lt;tt&amp;gt;#rgb&amp;lt;/tt&amp;gt;/&amp;lt;tt&amp;gt;#rrggbb&amp;lt;/tt&amp;gt; or by a [[:en:Web colors#X11 colour names|CSS color name]]. Instead of a list, the built-in color palettes [https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors &amp;lt;tt&amp;gt;category10&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;category20&amp;lt;/tt&amp;gt;] can also be used.&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;scaleType:&amp;#039;&amp;#039;&amp;#039; supported values are &amp;lt;tt&amp;gt;linear&amp;lt;/tt&amp;gt; for a linear mapping between the data values and the color scale, &amp;lt;tt&amp;gt;log&amp;lt;/tt&amp;gt; for a log mapping, &amp;lt;tt&amp;gt;pow&amp;lt;/tt&amp;gt; for a power mapping (the exponent can be provided as &amp;lt;tt&amp;gt;pow 0.5&amp;lt;/tt&amp;gt;), &amp;lt;tt&amp;gt;sqrt&amp;lt;/tt&amp;gt; for a square-root mapping, and &amp;lt;tt&amp;gt;quantize&amp;lt;/tt&amp;gt; for a quantized scale, i.e. the data is grouped in as many classes as the color palette has colors.&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;domainMin:&amp;#039;&amp;#039;&amp;#039; lower boundary of the data values, i.e. smaller data values are mapped to the lower boundary&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;domainMax:&amp;#039;&amp;#039;&amp;#039; upper boundary of the data values, i.e. larger data values are mapped to the upper boundary&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;legend:&amp;#039;&amp;#039;&amp;#039; show color legend (does not work with &amp;lt;tt&amp;gt;quantize&amp;lt;/tt&amp;gt;)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;defaultValue:&amp;#039;&amp;#039;&amp;#039; default value for unused geographic entities. In case the id values are colors the default value is &amp;lt;tt&amp;gt;silver&amp;lt;/tt&amp;gt;, in case of numbers it is 0.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;formatjson:&amp;#039;&amp;#039;&amp;#039; format JSON object for better legibility&lt;br /&gt;
=== &amp;lt;tt&amp;gt;chart&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Creates a JSON object for &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;graph&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; to display charts. In the article namespace the template {{tl|Graph:Chart}} should be used instead. See its page for use cases.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Parameters:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;width:&amp;#039;&amp;#039;&amp;#039; width of the chart&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;height:&amp;#039;&amp;#039;&amp;#039; height of the chart&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;type:&amp;#039;&amp;#039;&amp;#039; type of the chart: &amp;lt;tt&amp;gt;line&amp;lt;/tt&amp;gt; for [[:en:line chart|line chart]]s, &amp;lt;tt&amp;gt;area&amp;lt;/tt&amp;gt; for [[:en:area chart|area chart]]s, and &amp;lt;tt&amp;gt;rect&amp;lt;/tt&amp;gt; for (column) [[:en:bar chart|bar chart]]s, and &amp;lt;tt&amp;gt;pie&amp;lt;/tt&amp;gt; for [[:en:pie chart|pie chart]]s. Multiple series can stacked using the &amp;lt;tt&amp;gt;stacked&amp;lt;/tt&amp;gt; prefix, e.g. &amp;lt;tt&amp;gt;stackedarea&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;interpolate:&amp;#039;&amp;#039;&amp;#039; [[:en:interpolation|interpolation]] method for line and area charts. It is recommended to use &amp;lt;tt&amp;gt;monotone&amp;lt;/tt&amp;gt; for a [[:en:monotone cubic interpolation|monotone cubic interpolation]] – further supported values are listed at https://github.com/vega/vega/wiki/Marks#area.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;colors:&amp;#039;&amp;#039;&amp;#039; color palette of the chart as a comma-separated list of colors. The color values must be given either as &amp;lt;tt&amp;gt;#rgb&amp;lt;/tt&amp;gt;/&amp;lt;tt&amp;gt;#rrggbb&amp;lt;/tt&amp;gt;/&amp;lt;tt&amp;gt;#aarrggbb&amp;lt;/tt&amp;gt; or by a [[:en:Web colors#X11 colour names|CSS color name]]. For &amp;lt;tt&amp;gt;#aarrggbb&amp;lt;/tt&amp;gt; the &amp;lt;tt&amp;gt;aa&amp;lt;/tt&amp;gt; component denotes the [[:en:alpha channel|alpha channel]], i.e. FF=100% opacity, 80=50% opacity/transparency, etc. (The default color palette is [//github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors &amp;lt;tt&amp;gt;category10&amp;lt;/tt&amp;gt;]).&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;xAxisTitle&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;yAxisTitle:&amp;#039;&amp;#039;&amp;#039; captions of the x and y axes&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;xAxisMin, xAxisMax, yAxisMin,&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;yAxisMax:&amp;#039;&amp;#039;&amp;#039; minimum and maximum values of the x and y axes&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;xAxisFormat&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;yAxisFormat:&amp;#039;&amp;#039;&amp;#039; changes the formatting of the axis labels. Supported values are listed at https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#numbers for numbers and https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md for date/time. For example, the format &amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt; can be used to output percentages.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;xAxisAngle:&amp;#039;&amp;#039;&amp;#039; rotates the x axis labels by the specified angle. Recommended values are: -45, +45, -90, +90&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;xType&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;yType:&amp;#039;&amp;#039;&amp;#039; Data types of the values, e.g. &amp;lt;tt&amp;gt;integer&amp;lt;/tt&amp;gt; for integers, &amp;lt;tt&amp;gt;number&amp;lt;/tt&amp;gt; for real numbers, &amp;lt;tt&amp;gt;date&amp;lt;/tt&amp;gt; for dates (e.g. YYYY/MM/DD), and &amp;lt;tt&amp;gt;string&amp;lt;/tt&amp;gt; for ordinal values.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;#039;: the x-values as a comma-separated list (if a value itself contains a comma it must be escaped with a backslash, i.e. it needs to be written as &amp;lt;tt&amp;gt;\,&amp;lt;/tt&amp;gt;)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;y1, y2,&amp;#039;&amp;#039;&amp;#039; …: the y-values for one or several data series, respectively. For pie charts &amp;lt;tt&amp;gt;y2&amp;lt;/tt&amp;gt; denotes the radiuses of the corresponding sectors.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;legend:&amp;#039;&amp;#039;&amp;#039; show legend (only works in case of multiple data series)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;y1Title, y2Title,&amp;#039;&amp;#039;&amp;#039; …: defines the label of the respective data series in the legend&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;linewidth:&amp;#039;&amp;#039;&amp;#039; line width for line charts or distance between the pie segments for pie charts&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;showValues:&amp;#039;&amp;#039;&amp;#039; Additionally, output the y values as text. (Currently, only (non-stacked) bar and pie charts are supported.) The output can be configured used the following parameters provided as &amp;lt;tt&amp;gt;name1:value1, name2:value2&amp;lt;/tt&amp;gt;:&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;format:&amp;#039;&amp;#039;&amp;#039; Format the output according to https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#numbers for numbers and https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md for date/time.&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;fontcolor:&amp;#039;&amp;#039;&amp;#039; text color&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;fontsize:&amp;#039;&amp;#039;&amp;#039; text size&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;offset:&amp;#039;&amp;#039;&amp;#039; move text by the given offset. For bar charts and pie charts with &amp;lt;tt&amp;gt;midangle&amp;lt;/tt&amp;gt; this also defines if the text is inside or outside the chart.&lt;br /&gt;
** &amp;#039;&amp;#039;&amp;#039;angle&amp;#039;&amp;#039;&amp;#039; (pie charts only): text angle in degrees or &amp;lt;tt&amp;gt;midangle&amp;lt;/tt&amp;gt; (default) for dynamic angles based on the mid-angle of the pie sector.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;innerRadius:&amp;#039;&amp;#039;&amp;#039; For pie charts: defines the inner radius to create a &amp;#039;&amp;#039;doughnut chart.&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;formatjson:&amp;#039;&amp;#039;&amp;#039; format JSON object for better legibility&lt;br /&gt;
&lt;br /&gt;
=== Template wrappers ===&lt;br /&gt;
The functions &amp;lt;tt&amp;gt;mapWrapper&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;chartWrapper&amp;lt;/tt&amp;gt; are wrappers to pass all parameters of the calling template to the respective &amp;lt;tt&amp;gt;map&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;chart&amp;lt;/tt&amp;gt; functions.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; In the editor preview the graph extension creates a [[:en:canvas element|canvas element]] with vector graphics. However, when saving the page a [[:en:Portable Network Graphics|PNG]] raster graphics is generated instead.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note to developers:&amp;#039;&amp;#039;&amp;#039; New functionality can be tested with the [https://vega.github.io/vega-editor/index.html?mode=vega Vega Editor], that also contains a large amount of example code.&lt;/div&gt;</summary>
		<author><name>en&gt;Pppery</name></author>
	</entry>
</feed>