<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AChart_data%2Fdoc</id>
	<title>Module:Chart data/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AChart_data%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Chart_data/doc&amp;action=history"/>
	<updated>2026-04-30T11:21:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=Module:Chart_data/doc&amp;diff=34040&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;{{documentation}} Helps create the json to generate charts using [https://www.chartjs.org/ Chart.js] through MediaWiki:Gadget-Charts-core.js.  {{Helper module|name = Chart data |fname1 = _main(&amp;nbsp;args&amp;nbsp;) |ftype1 = table/chart |fuse1 = Turns a table/chart object into a json string.  |fname2 = &lt;nowiki&gt;convertToXYFormat(&amp;nbsp;ys, [xs|{}]&amp;nbsp;)&lt;/nowiki&gt; |ftype2 = table, table |fuse2 = Converts the &lt;code&gt;ys&lt;/code&gt; array into an array of &lt;code&gt;{x = n, y = y[n]}&lt;/co...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=Module:Chart_data/doc&amp;diff=34040&amp;oldid=prev"/>
		<updated>2024-10-15T17:22:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{documentation}} Helps create the json to generate charts using [https://www.chartjs.org/ Chart.js] through &lt;a href=&quot;/w/MediaWiki:Gadget-Charts-core.js&quot; title=&quot;MediaWiki:Gadget-Charts-core.js&quot;&gt;MediaWiki:Gadget-Charts-core.js&lt;/a&gt;.  {{Helper module|name = Chart data |fname1 = _main( args ) |ftype1 = table/chart |fuse1 = Turns a table/chart object into a json string.  |fname2 = &amp;lt;nowiki&amp;gt;convertToXYFormat( ys, [xs|{}] )&amp;lt;/nowiki&amp;gt; |ftype2 = table, table |fuse2 = Converts the &amp;lt;code&amp;gt;ys&amp;lt;/code&amp;gt; array into an array of &amp;lt;code&amp;gt;{x = n, y = y[n]}&amp;lt;/co...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{documentation}}&lt;br /&gt;
Helps create the json to generate charts using [https://www.chartjs.org/ Chart.js] through [[MediaWiki:Gadget-Charts-core.js]].&lt;br /&gt;
&lt;br /&gt;
{{Helper module|name = Chart data&lt;br /&gt;
|fname1 = _main(&amp;amp;nbsp;args&amp;amp;nbsp;)&lt;br /&gt;
|ftype1 = table/chart&lt;br /&gt;
|fuse1 = Turns a table/chart object into a json string.&lt;br /&gt;
&lt;br /&gt;
|fname2 = &amp;lt;nowiki&amp;gt;convertToXYFormat(&amp;amp;nbsp;ys, [xs|{}]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype2 = table, table&lt;br /&gt;
|fuse2 = Converts the &amp;lt;code&amp;gt;ys&amp;lt;/code&amp;gt; array into an array of &amp;lt;code&amp;gt;{x = n, y = y[n]}&amp;lt;/code&amp;gt; tables. If &amp;lt;code&amp;gt;xs&amp;lt;/code&amp;gt; is already partially filled it will use &amp;lt;code&amp;gt;{x = x[n], y = y[n]}&amp;lt;/code&amp;gt; until all values in &amp;lt;code&amp;gt;xs&amp;lt;/code&amp;gt; are used, then it will use &amp;lt;code&amp;gt;{x = n, y = y[n]}&amp;lt;/code&amp;gt; again for the remaining values in &amp;lt;code&amp;gt;ys&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|fname3 = &amp;lt;nowiki&amp;gt;generateXYFromFunc(&amp;amp;nbsp;func, start_x, end_x, [step|1]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype3 = function, number, number, number&lt;br /&gt;
|fuse3 = Returns an array of &amp;lt;code&amp;gt;{x = n, y = fun(n)}&amp;lt;/code&amp;gt; tables where n ranges from &amp;lt;code&amp;gt;start_x&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;end_x&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;step&amp;lt;/code&amp;gt; increments. Be careful when using decimal &amp;lt;code&amp;gt;step&amp;lt;/code&amp;gt; values as floating point error can cause the generator to stop one element too soon.&lt;br /&gt;
&lt;br /&gt;
|fname4 = &amp;lt;nowiki&amp;gt;jagexInterpolation(&amp;amp;nbsp;low_chance, high_chance, start_level, end_level&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype4 = number, number, number, number&lt;br /&gt;
|fuse4 =&lt;br /&gt;
&lt;br /&gt;
|fname5 = &amp;lt;nowiki&amp;gt;newChart(&amp;amp;nbsp;[options]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype5 = table&lt;br /&gt;
|fuse5 = Returns a new chart object. &amp;lt;code&amp;gt;options&amp;lt;/code&amp;gt; is a table with options in the [https://www.chartjs.org/ Chart.js] format. Most options will be set automatically or will be set later with other functions if not already defined. Usually all you need to define here is the chart type e.g. &amp;lt;code&amp;gt;newChart{ type = &amp;#039;scatter&amp;#039; }&amp;lt;/code&amp;gt;. &amp;#039;&amp;#039;&amp;#039;Check the modules documentation for more info&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname6 = &amp;lt;nowiki&amp;gt;chart:addDataSets(&amp;amp;nbsp;...&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype6 = table/dataSet object&lt;br /&gt;
|fuse6 = Appends all given data sets to the &amp;lt;code&amp;gt;chart.data.datasets&amp;lt;/code&amp;gt; table.&lt;br /&gt;
&lt;br /&gt;
|fname7 = &amp;lt;nowiki&amp;gt;chart:addDataLabels(&amp;amp;nbsp;labels&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype7 = table&lt;br /&gt;
|fuse7 = Appends all items in &amp;lt;code&amp;gt;labels&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;chart.data.labels&amp;lt;/code&amp;gt; table.&lt;br /&gt;
&lt;br /&gt;
|fname8 = &amp;lt;nowiki&amp;gt;chart:setDimensions(&amp;amp;nbsp;width, [height|width], [minWidth|400], [minHeight|400], [resizable|false]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype8 = number/string, number/string, number/string, number/string, boolean&lt;br /&gt;
|fuse8 = Sets the dimensions of the chart. If a number is given to &amp;lt;code&amp;gt;width&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;height&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;minWidth&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;minHeight&amp;lt;/code&amp;gt; it will be assumed you meant pixels. You can also use strings like &amp;lt;code&amp;gt;100%&amp;lt;/code&amp;gt; to fill the available space, &amp;lt;code&amp;gt;40vw&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;40vh&amp;lt;/code&amp;gt; to dynamically scale the simensions to the viewport size (i.e. 40vw = 40% of browser&amp;#039;s window width). If &amp;lt;code&amp;gt;resizable&amp;lt;/code&amp;gt; is true, the chart can be dragged by the lower right corner to change its size.&lt;br /&gt;
&lt;br /&gt;
|fname9 = &amp;lt;nowiki&amp;gt;chart:setTitle(&amp;amp;nbsp;[text|nil], [position|&amp;#039;top&amp;#039;]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype9 = string, string&lt;br /&gt;
|fuse9 = Sets the label title of the chart. A value of nil will remove the current title.&lt;br /&gt;
&lt;br /&gt;
|fname10 = &amp;lt;nowiki&amp;gt;chart:setXLabel(&amp;amp;nbsp;[label|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype10 = string&lt;br /&gt;
|fuse10 = Sets the label for the x axis. Only works on chart types &amp;#039;line&amp;#039;, &amp;#039;bar&amp;#039;, &amp;#039;horizontalBar&amp;#039;, &amp;#039;bubble&amp;#039; and &amp;#039;scatter&amp;#039;. If used without arguments it will remove the current label.&lt;br /&gt;
&lt;br /&gt;
|fname11 = &amp;lt;nowiki&amp;gt;chart:setYLabel(&amp;amp;nbsp;[label|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype11 = string&lt;br /&gt;
|fuse11 = Sets the label for the y axis. Only works on chart types &amp;#039;line&amp;#039;, &amp;#039;bar&amp;#039;, &amp;#039;horizontalBar&amp;#039;, &amp;#039;bubble&amp;#039; and &amp;#039;scatter&amp;#039;. If used without arguments it will remove the current label.&lt;br /&gt;
&lt;br /&gt;
|fname12 = &amp;lt;nowiki&amp;gt;chart:setXLimits(&amp;amp;nbsp;[min|nil], [max|nil], [step|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype12 = number, number, number&lt;br /&gt;
|fuse12 = Sets the start, stop and step size of the x axis. Any argument with a value of nil will remove that setting. Only works on chart types &amp;#039;horizontalBar&amp;#039;, &amp;#039;bubble&amp;#039; and &amp;#039;scatter&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname13 = &amp;lt;nowiki&amp;gt;chart:setYLimits(&amp;amp;nbsp;[min|nil], [max|nil], [step|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype13 = number, number, number&lt;br /&gt;
|fuse13 = Sets the start, stop and step size of the y axis. Any argument with a value of nil will remove that setting. Only works on chart types &amp;#039;line&amp;#039;, &amp;#039;bar&amp;#039;, &amp;#039;bubble&amp;#039; and &amp;#039;scatter&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname14 = &amp;lt;nowiki&amp;gt;chart:setRadialLimits(&amp;amp;nbsp;[min|nil], [max|nil], [step|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype14 = number, number, number&lt;br /&gt;
|fuse14 = Sets the start, stop and step size of the r axis on polar plots. Any argument with a value of nil will remove that setting. Only works on chart types &amp;#039;radar&amp;#039; and &amp;#039;polarArea&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname15 = &amp;lt;nowiki&amp;gt;chart:setXAxisType(&amp;amp;nbsp;[type|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype15 = string&lt;br /&gt;
|fuse15 = Sets the axis type. Supported values are &amp;#039;linear&amp;#039;, &amp;#039;logarithmic&amp;#039;, &amp;#039;category&amp;#039; and &amp;#039;time&amp;#039;. If called without arguments it will reset back to the default value &amp;#039;linear&amp;#039;. Only works on chart types &amp;#039;bubble&amp;#039;, &amp;#039;scatter&amp;#039; and &amp;#039;horizontalBar&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname16 = &amp;lt;nowiki&amp;gt;chart:setYAxisType(&amp;amp;nbsp;[type|nil]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype16 = string&lt;br /&gt;
|fuse16 = Same as &amp;lt;code&amp;gt;chart:setXAxisType()&amp;lt;/code&amp;gt; but for the y axis. Only works on chart types &amp;#039;line&amp;#039;, &amp;#039;bubble&amp;#039;, &amp;#039;scatter&amp;#039; and &amp;#039;bar&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
|fname17 = &amp;lt;nowiki&amp;gt;chart:setOptions(&amp;amp;nbsp;options&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype17 = table&lt;br /&gt;
|fuse17 = Sets options using [https://www.chartjs.org/ Chart.js] format but makes sure you only change the given settings and not accidentally delete already existing settings. i.e. using &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;chart:setOptions{ options = {scales = {ticks = {max = 100}}} }&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; while &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{options = {scales = {ticks = {min = 0}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; already exists will result in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{options = {scales = {ticks = {min = 0, max = 100}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|fname18 = &amp;lt;nowiki&amp;gt;chart:makeMwLoadDataCompatible()&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype18 = N/A&lt;br /&gt;
|fuse18 = Strips metatables so that it can be loaded by &amp;lt;code&amp;gt;mw.loadData()&amp;lt;/code&amp;gt;making it possible to display the table using {{t|Chart data|&amp;lt;module name&amp;gt;}}. This should only be used at the very end when you are done creating your chart.&lt;br /&gt;
&lt;br /&gt;
|fname19 = &amp;lt;nowiki&amp;gt;chart:newDataSet(&amp;amp;nbsp;[options]&amp;amp;nbsp;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|ftype19 = table&lt;br /&gt;
|fuse19 = Returns a new dataSet object which is also automatically added to the chart datasets table.&lt;br /&gt;
&lt;br /&gt;
|fname20 = dataSet:addData(&amp;amp;nbsp;data&amp;amp;nbsp;)&lt;br /&gt;
|ftype20 = table&lt;br /&gt;
|fuse20 = Appends the values of &amp;lt;code&amp;gt;data&amp;lt;/code&amp;gt; to the already existing data stored in the dataSet.data array. Using &amp;lt;code&amp;gt;dataset.data = data&amp;lt;/code&amp;gt; will overwrite any stored data.&lt;br /&gt;
&lt;br /&gt;
|fname21 = dataSet:addDataPoint(&amp;amp;nbsp;data&amp;amp;nbsp;)&lt;br /&gt;
|ftype21 = number/table&lt;br /&gt;
|fuse21 = Append a single value to the &amp;lt;code&amp;gt;dataSet.data&amp;lt;/code&amp;gt; array. Same as &amp;lt;code&amp;gt;table.insert(&amp;amp;nbsp;dataSet.data, data&amp;amp;nbsp;)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|fname22 = dataSet:setOptions(&amp;amp;nbsp;options&amp;amp;nbsp;)&lt;br /&gt;
|ftype22 = table&lt;br /&gt;
|fuse22 = Sets options using [https://www.chartjs.org/ Chart.js] format.&lt;br /&gt;
&lt;br /&gt;
|example =&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;#039;lua&amp;#039;&amp;gt;&lt;br /&gt;
local p = {}&lt;br /&gt;
local chart = require( &amp;#039;Module:Chart data&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
-- This chart can then be added to a page using {{Chart data|&amp;lt;module name&amp;gt;}}&lt;br /&gt;
function p.pie()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;pie&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;40vw&amp;#039;, nil, 400, nil, true ) -- Pie chart is always square&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.green&lt;br /&gt;
    local labels = {}&lt;br /&gt;
    local set = plot:newDataSet()&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p.pie()&lt;br /&gt;
&lt;br /&gt;
-------------------------------------------------------------&lt;br /&gt;
local p = {}&lt;br /&gt;
local chart = require( &amp;#039;Module:Chart data&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
-- This chart cound be used by another module or drawn using {{#Invoke:&amp;lt;module name&amp;gt;|bar}}&lt;br /&gt;
function p.bar()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;bar&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;40%&amp;#039;, 600, 400, 400, true )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 2 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 6 do&lt;br /&gt;
            set:addDataPoint( math.sqrt( i*j ) )&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 1 then&lt;br /&gt;
            set.color = chart.colorPallets.green[3]&lt;br /&gt;
        else&lt;br /&gt;
            set.color = chart.colorPallets.orange[3]&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
To create a chart we need to create JSON in a format described by [https://www.chartjs.org/docs/latest/charts/line.html chart.js].&lt;br /&gt;
To make this a bit easier we can write a lua table instead which is then converted to a JSON using &amp;lt;code&amp;gt;chart._main()&amp;lt;/code&amp;gt;.&lt;br /&gt;
An example of this is [[Module:Chart data/xp chart]], which can then be displayed on a page using {{t|Chart data|Chart data/xp chart|width=40vw|height=40vh}} resulting in:&lt;br /&gt;
&lt;br /&gt;
{{Chart data|Chart data/xp chart|width=40vw|height=40vh}}&lt;br /&gt;
&lt;br /&gt;
To make the construction of this table a bit easier, the chart class is provided which internally has the extact same structure as if we manually created the table. The chart class just sets a bunch of default settings based on what chart type you are creating; it also makes it a lot easier to deal with the colors of your data and provides a bunch of functions to easily set axis labels, axis start and stop values, axis type, etc.&lt;br /&gt;
===Color pallets===&lt;br /&gt;
chart.colorPallets has a few pre-defined color pallets. These pallets are made up of [[Module:Rgba]] objects. They also have a metatable set which allows them to automatically use the next color pallet in case the current pallet has less colors than your number of datasets.&lt;br /&gt;
&lt;br /&gt;
You can set your preferred pallet for your chart with &amp;lt;code&amp;gt;myChart.colorPallet = chart.collorPallets.blue&amp;lt;/code&amp;gt;, in case of chart type bar of horizontalbar your can also set it per data set &amp;lt;code&amp;gt;myDataSet.colorPallet = chart.collorPallets.orange&amp;lt;/code&amp;gt; or if you want all bars of a given set to be the same color &amp;lt;code&amp;gt;myDataSet.color = chart.collorpallets.orange[3]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It is possible to define your own color pallet as an array of [[Module:Rgba]] objects.&lt;br /&gt;
&lt;br /&gt;
The chart class has the following color opions:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;backgroundAlpha&amp;lt;/code&amp;gt; - sets the &amp;lt;code&amp;gt;rgba:fade()&amp;lt;/code&amp;gt; value for background colors.&lt;br /&gt;
* &amp;lt;code&amp;gt;hoverLightenValue&amp;lt;/code&amp;gt; - sets the &amp;lt;code&amp;gt;rgba:lighten()&amp;lt;/code&amp;gt; value for when you hover over a data point.&lt;br /&gt;
* &amp;lt;code&amp;gt;hoverAlpha&amp;lt;/code&amp;gt; - sets the &amp;lt;code&amp;gt;rgba:fade()&amp;lt;/code&amp;gt; value for when you hover over a data point.&lt;br /&gt;
* &amp;lt;code&amp;gt;hoverSaturateValue&amp;lt;/code&amp;gt; - sets the &amp;lt;code&amp;gt;rgba:saturate()&amp;lt;/code&amp;gt; value for when you hover over a data point.&lt;br /&gt;
&lt;br /&gt;
Their default value depend on the cart type but you can manually set them using:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chart:setOptions{&lt;br /&gt;
    backgroundAlpha = &amp;lt;number&amp;gt;,&lt;br /&gt;
    hoverLightenValue = &amp;lt;number&amp;gt;,&lt;br /&gt;
    hoverAlpha = &amp;lt;number&amp;gt;,&lt;br /&gt;
    hoverSaturateValue = &amp;lt;number&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:flex;flex-wrap:wrap;align-items:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorQualitative}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorQualitative}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorQualitative()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Qualitative&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.qualitative&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorBlue}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorBlue}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorBlue()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Blue&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.blue&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorGreen}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorGreen}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorGreen()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Green&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.green&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorBlueGreen}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorBlueGreen}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorBlueGreen()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;BlueGreen&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.blueGreen&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorOrange}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorOrange}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorOrange()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Orange&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.orange&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorOverflow}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorOverflow}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorOverflow()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Color overflow&amp;#039; )&lt;br /&gt;
    plot:setOptions{&lt;br /&gt;
        options = {&lt;br /&gt;
            legend = {&lt;br /&gt;
                display = false&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = chart.colorPallets.orange&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 25 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|customColorPallet}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|customColorPallet}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.customColorPallet()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Custom color pallet&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
    plot.colorPallet = {&lt;br /&gt;
        chart.rgba.new(0,0,0),&lt;br /&gt;
        chart.rgba.new(126,0,0),&lt;br /&gt;
        chart.rgba.new(0,126,0),&lt;br /&gt;
        chart.rgba.new(0,0,126),&lt;br /&gt;
        chart.rgba.new(255,0,0),&lt;br /&gt;
        chart.rgba.new(0,255,0),&lt;br /&gt;
        chart.rgba.new(0,0,255),&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    for i = 1, #plot.colorPallet do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|colorOptions}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|colorOptions}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.colorOptions()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;bar&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Color options&amp;#039; )&lt;br /&gt;
    plot:setOptions{&lt;br /&gt;
        backgroundAlpha = 0.8,&lt;br /&gt;
        hoverLightenValue = 0.5,&lt;br /&gt;
        hoverAlpha = 0.4,&lt;br /&gt;
        hoverSaturateValue = 1.5,&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 2 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 6 do&lt;br /&gt;
            set:addDataPoint( math.sqrt( i*j ) )&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 1 then&lt;br /&gt;
            set.color = chart.colorPallets.green[3]&lt;br /&gt;
        else&lt;br /&gt;
            set.color = chart.colorPallets.orange[3]&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
===Examples===&lt;br /&gt;
&amp;lt;div style=&amp;quot;display:flex;flex-wrap:wrap;align-items:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{#Invoke:Chart data/doc examples|line}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#Invoke:Chart data/doc examples|line}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.line()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;line&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Line chart&amp;#039; )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 2 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = { i^2, (i+1)^2, (i+2)^2, (i+3^2), (i+4)^2 }&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
        set.borderDash = {5, 5}&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 5 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return &amp;#039;Prefix text message&amp;#039; .. plot .. &amp;#039;Affix text message&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|bar}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|bar}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.bar()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;bar&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Bar chart&amp;#039; )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 2 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 6 do&lt;br /&gt;
            set:addDataPoint( math.sqrt( i*j ) )&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 1 then&lt;br /&gt;
            set.color = chart.colorPallets.green[3]&lt;br /&gt;
        else&lt;br /&gt;
            set.color = chart.colorPallets.orange[3]&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|horizontalBar}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|horizontalBar}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.horizontalBar()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;horizontalBar&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;HorizontalBar chart&amp;#039; )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 2 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 6 do&lt;br /&gt;
            set:addDataPoint( math.sqrt( i*j ) )&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 1 then&lt;br /&gt;
            set.color = chart.colorPallets.green[3]&lt;br /&gt;
        else&lt;br /&gt;
            set.color = chart.colorPallets.orange[3]&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|radar}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|radar}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.radar()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;radar&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, nil, 300, nil, true ) -- Radar chart is always square. height = width&lt;br /&gt;
    plot:setTitle( &amp;#039;Radar chart&amp;#039; )&lt;br /&gt;
    plot:setRadialLimits( 0, 5 )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 5 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 6 do&lt;br /&gt;
            set:addDataPoint( math.sqrt( i*j*(math.random()+1) ) )&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 3 then&lt;br /&gt;
            set.fill = true&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|pie}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|pie}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.pie()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;pie&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, nil, 300, nil, true ) -- Pie chart is always square. height = width&lt;br /&gt;
    plot:setTitle( &amp;#039;Pie chart&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
    local set = plot:newDataSet()&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|doughnut}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|doughnut}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.doughnut()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;doughnut&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, nil, 300, nil, true ) -- doughnut chart is always square. height = width&lt;br /&gt;
    plot:setTitle( &amp;#039;Doughnut chart&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
    local set = plot:newDataSet()&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|polarArea}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|polarArea}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.polarArea()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;polarArea&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, nil, 300, nil, true ) -- polarArea chart is always square. height = width&lt;br /&gt;
    plot:setTitle( &amp;#039;PolarArea chart&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    local labels = {}&lt;br /&gt;
    local set = plot:newDataSet()&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 6 do&lt;br /&gt;
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )&lt;br /&gt;
        table.insert( labels, &amp;#039;Value &amp;#039; .. i )&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    plot:addDataLabels( labels )&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|bubble}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|bubble}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.bubble()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;bubble&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Bubble chart&amp;#039; )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 5 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        for j = 1, 5 do&lt;br /&gt;
            set:addDataPoint{ x = math.random() * 10, y = math.random() * 20, r = math.random() * 15 + 5 }&lt;br /&gt;
        end&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
{{Chart data|Chart data/doc examples|scatter}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;width:100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|Code&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
{{t|Chart data|Chart data/doc examples|scatter}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function p.scatter()&lt;br /&gt;
    local plot = chart.newChart{ type = &amp;#039;scatter&amp;#039; }&lt;br /&gt;
    plot:setDimensions( &amp;#039;10vw&amp;#039;, &amp;#039;10vh&amp;#039;, 300, 300, true )&lt;br /&gt;
    plot:setTitle( &amp;#039;Scatter chart&amp;#039; )&lt;br /&gt;
    plot:setXLabel( &amp;#039;x axis label&amp;#039; )&lt;br /&gt;
    plot:setYLabel( &amp;#039;y axis label&amp;#039; )&lt;br /&gt;
    plot:setYAxisType( &amp;#039;logarithmic&amp;#039; )&lt;br /&gt;
    plot.fill = false&lt;br /&gt;
&lt;br /&gt;
    for i = 1, 5 do&lt;br /&gt;
        local set = plot:newDataSet()&lt;br /&gt;
        set.data = chart.generateXYFromFunc( function(x) return (math.sin( x/5 ) * 5 + x)^i end, 0, 100 )&lt;br /&gt;
        set.label = &amp;#039;Set &amp;#039; .. i&lt;br /&gt;
&lt;br /&gt;
        if i == 2 then&lt;br /&gt;
            set.fill = &amp;#039;+2&amp;#039;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return plot:makeMwLoadDataCompatible()&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>