<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.nerdsgocasual.de/index.php?action=history&amp;feed=atom&amp;title=Module%3AGraph%2Fdoc</id>
	<title>Module:Graph/doc - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nerdsgocasual.de/index.php?action=history&amp;feed=atom&amp;title=Module%3AGraph%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.nerdsgocasual.de/index.php?title=Module:Graph/doc&amp;action=history"/>
	<updated>2026-05-07T17:03:04Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Nerds Go Wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.nerdsgocasual.de/index.php?title=Module:Graph/doc&amp;diff=12709&amp;oldid=prev</id>
		<title>IrishWolf: Die Seite wurde neu angelegt: „Module with helper functions for the Graph extension.  == Functions for templates == === &lt;code&gt;map&lt;/code&gt; === Creates a JSON object for &lt;co…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.nerdsgocasual.de/index.php?title=Module:Graph/doc&amp;diff=12709&amp;oldid=prev"/>
		<updated>2022-04-01T15:51:52Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „Module with helper functions for the &lt;a href=&quot;/index.php?title=Extension:Graph&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Extension:Graph (Seite nicht vorhanden)&quot;&gt;Graph&lt;/a&gt; extension.  == Functions for templates == === &amp;lt;code&amp;gt;map&amp;lt;/code&amp;gt; === Creates a JSON object for &amp;lt;co…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&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;code&amp;gt;map&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Creates a JSON object for &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;graph&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&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;
'''Parameters:'''&lt;br /&gt;
* '''basemap:''' 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;code&amp;gt;//en.wikipedia.org/w/index.php?title=''mapname''&amp;amp;action=raw&amp;lt;/code&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;
* '''scale:''' the scaling factor of the map (default: 100)&lt;br /&gt;
* '''projection:''' 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;code&amp;gt;equirectangular&amp;lt;/code&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;code&amp;gt;DE=lightblue&amp;lt;/code&amp;gt; marks Germany in light blue color, and &amp;lt;code&amp;gt;DE=80.6&amp;lt;/code&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;
** '''colorScale:''' 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;code&amp;gt;#rgb&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;#rrggbb&amp;lt;/code&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;code&amp;gt;category10&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;category20&amp;lt;/code&amp;gt;] can also be used.&lt;br /&gt;
** '''scaleType:''' supported values are &amp;lt;code&amp;gt;linear&amp;lt;/code&amp;gt; for a linear mapping between the data values and the color scale, &amp;lt;code&amp;gt;log&amp;lt;/code&amp;gt; for a log mapping, &amp;lt;code&amp;gt;pow&amp;lt;/code&amp;gt; for a power mapping (the exponent can be provided as &amp;lt;code&amp;gt;pow 0.5&amp;lt;/code&amp;gt;), &amp;lt;code&amp;gt;sqrt&amp;lt;/code&amp;gt; for a square-root mapping, and &amp;lt;code&amp;gt;quantize&amp;lt;/code&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;
** '''domainMin:''' lower boundary of the data values, i.e. smaller data values are mapped to the lower boundary&lt;br /&gt;
** '''domainMax:''' upper boundary of the data values, i.e. larger data values are mapped to the upper boundary&lt;br /&gt;
** '''legend:''' show color legend (does not work with &amp;lt;code&amp;gt;quantize&amp;lt;/code&amp;gt;)&lt;br /&gt;
* '''defaultValue:''' default value for unused geographic entities. In case the id values are colors the default value is &amp;lt;code&amp;gt;silver&amp;lt;/code&amp;gt;, in case of numbers it is 0.&lt;br /&gt;
* '''formatjson:''' format JSON object for better legibility&lt;br /&gt;
=== &amp;lt;code&amp;gt;chart&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Creates a JSON object for &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;graph&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&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;
'''Parameters:'''&lt;br /&gt;
* '''width:''' width of the chart&lt;br /&gt;
* '''height:''' height of the chart&lt;br /&gt;
* '''type:''' type of the chart: &amp;lt;code&amp;gt;line&amp;lt;/code&amp;gt; for [[:en:line chart|line chart]]s, &amp;lt;code&amp;gt;area&amp;lt;/code&amp;gt; for [[:en:area chart|area chart]]s, and &amp;lt;code&amp;gt;rect&amp;lt;/code&amp;gt; for (column) [[:en:bar chart|bar chart]]s, and &amp;lt;code&amp;gt;pie&amp;lt;/code&amp;gt; for [[:en:pie chart|pie chart]]s. Multiple series can stacked using the &amp;lt;code&amp;gt;stacked&amp;lt;/code&amp;gt; prefix, e.g. &amp;lt;code&amp;gt;stackedarea&amp;lt;/code&amp;gt;.&lt;br /&gt;
* '''interpolate:''' [[:en:interpolation|interpolation]] method for line and area charts. It is recommended to use &amp;lt;code&amp;gt;monotone&amp;lt;/code&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;
* '''colors:''' color palette of the chart as a comma-separated list of colors. The color values must be given either as &amp;lt;code&amp;gt;#rgb&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;#rrggbb&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;#aarrggbb&amp;lt;/code&amp;gt; or by a [[:en:Web colors#X11 colour names|CSS color name]]. For &amp;lt;code&amp;gt;#aarrggbb&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;aa&amp;lt;/code&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;code&amp;gt;category10&amp;lt;/code&amp;gt;]).&lt;br /&gt;
* '''xAxisTitle''' and '''yAxisTitle:''' captions of the x and y axes&lt;br /&gt;
* '''xAxisMin, xAxisMax, yAxisMin,''' and '''yAxisMax:''' minimum and maximum values of the x and y axes&lt;br /&gt;
* '''xAxisFormat''' and '''yAxisFormat:''' 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;code&amp;gt;%&amp;lt;/code&amp;gt; can be used to output percentages.&lt;br /&gt;
* '''xAxisAngle:''' rotates the x axis labels by the specified angle. Recommended values are: -45, +45, -90, +90&lt;br /&gt;
* '''xType''' and '''yType:''' Data types of the values, e.g. &amp;lt;code&amp;gt;integer&amp;lt;/code&amp;gt; for integers, &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; for real numbers, &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; for dates (e.g. YYYY/MM/DD), and &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; for ordinal values.&lt;br /&gt;
* '''x''': 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;code&amp;gt;\,&amp;lt;/code&amp;gt;)&lt;br /&gt;
* '''y''' or '''y1, y2,''' …: the y-values for one or several data series, respectively. For pie charts &amp;lt;code&amp;gt;y2&amp;lt;/code&amp;gt; denotes the radiuses of the corresponding sectors.&lt;br /&gt;
* '''legend:''' show legend (only works in case of multiple data series)&lt;br /&gt;
* '''y1Title, y2Title,''' …: defines the label of the respective data series in the legend&lt;br /&gt;
* '''linewidth:''' line width for line charts or distance between the pie segments for pie charts&lt;br /&gt;
* '''showValues:''' 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;code&amp;gt;name1:value1, name2:value2&amp;lt;/code&amp;gt;:&lt;br /&gt;
** '''format:''' 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;
** '''fontcolor:''' text color&lt;br /&gt;
** '''fontsize:''' text size&lt;br /&gt;
** '''offset:''' move text by the given offset. For bar charts and pie charts with &amp;lt;code&amp;gt;midangle&amp;lt;/code&amp;gt; this also defines if the text is inside or outside the chart.&lt;br /&gt;
** '''angle''' (pie charts only): text angle in degrees or &amp;lt;code&amp;gt;midangle&amp;lt;/code&amp;gt; (default) for dynamic angles based on the mid-angle of the pie sector.&lt;br /&gt;
* '''innerRadius:''' For pie charts: defines the inner radius to create a ''doughnut chart.''&lt;br /&gt;
* '''formatjson:''' format JSON object for better legibility&lt;br /&gt;
&lt;br /&gt;
=== Template wrappers ===&lt;br /&gt;
The functions &amp;lt;code&amp;gt;mapWrapper&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;chartWrapper&amp;lt;/code&amp;gt; are wrappers to pass all parameters of the calling template to the respective &amp;lt;code&amp;gt;map&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;chart&amp;lt;/code&amp;gt; functions.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' 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;
'''Note to developers:''' New functionality can be tested with the [https://vega.github.io/editor/#/custom/vega Vega Editor], that also contains a large amount of example code.&lt;/div&gt;</summary>
		<author><name>IrishWolf</name></author>
	</entry>
</feed>