Module:Chart data

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 18:22, 15 October 2024 (Created page with "-- <nowiki> ---@class chart local chart = {} ---@class dataSet local dataSet = {} local libraryUtil = require( 'Module:libraryUtil' ) local rgba = require( 'Module:Rgba' ) local isEmpty = require( 'Module:Paramtest' ).is_empty local arr = require( 'Module:Array' ) ---@alias xyData table<string, number> ---@alias xyDataSet xyData[] ---@alias dataArr number[] ---@alias options_t table<string, string|number|options_t> ---@param val any ---@param default any ---@return a..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:Chart data/doc. [edit] [history] [purge]
Module:Chart data's function main is invoked by Template:Chart data.
Module:Chart data requires Module:Array.
Module:Chart data requires Module:LibraryUtil.
Module:Chart data requires Module:Paramtest.
Module:Chart data requires Module:Rgba.

Helps create the json to generate charts using Chart.js through MediaWiki:Gadget-Charts-core.js.

This module is a helper module to be used by other modules; it may not designed to be invoked directly. See RuneScape:Lua/Helper modules for a full list and more information. For a full list of modules using this helper click here

FunctionTypeUse
_main( args )table/chartTurns a table/chart object into a json string.
convertToXYFormat( ys, [xs|{}] )table, tableConverts the ys array into an array of {x = n, y = y[n]} tables. If xs is already partially filled it will use {x = x[n], y = y[n]} until all values in xs are used, then it will use {x = n, y = y[n]} again for the remaining values in ys.
generateXYFromFunc( func, start_x, end_x, [step|1] )function, number, number, numberReturns an array of {x = n, y = fun(n)} tables where n ranges from start_x to end_x in step increments. Be careful when using decimal step values as floating point error can cause the generator to stop one element too soon.
jagexInterpolation( low_chance, high_chance, start_level, end_level )number, number, number, number
newChart( [options] )tableReturns a new chart object. options is a table with options in the 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. newChart{ type = 'scatter' }. Check the modules documentation for more info.
chart:addDataSets( ... )table/dataSet objectAppends all given data sets to the chart.data.datasets table.
chart:addDataLabels( labels )tableAppends all items in labels to the chart.data.labels table.
chart:setDimensions( width, [height|width], [minWidth|400], [minHeight|400], [resizable|false] )number/string, number/string, number/string, number/string, booleanSets the dimensions of the chart. If a number is given to width, height, minWidth and minHeight it will be assumed you meant pixels. You can also use strings like 100% to fill the available space, 40vw/40vh to dynamically scale the simensions to the viewport size (i.e. 40vw = 40% of browser's window width). If resizable is true, the chart can be dragged by the lower right corner to change its size.
chart:setTitle( [text|nil], [position|'top'] )string, stringSets the label title of the chart. A value of nil will remove the current title.
chart:setXLabel( [label|nil] )stringSets the label for the x axis. Only works on chart types 'line', 'bar', 'horizontalBar', 'bubble' and 'scatter'. If used without arguments it will remove the current label.
chart:setYLabel( [label|nil] )stringSets the label for the y axis. Only works on chart types 'line', 'bar', 'horizontalBar', 'bubble' and 'scatter'. If used without arguments it will remove the current label.
chart:setXLimits( [min|nil], [max|nil], [step|nil] )number, number, numberSets 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 'horizontalBar', 'bubble' and 'scatter'.
chart:setYLimits( [min|nil], [max|nil], [step|nil] )number, number, numberSets 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 'line', 'bar', 'bubble' and 'scatter'.
chart:setRadialLimits( [min|nil], [max|nil], [step|nil] )number, number, numberSets 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 'radar' and 'polarArea'.
chart:setXAxisType( [type|nil] )stringSets the axis type. Supported values are 'linear', 'logarithmic', 'category' and 'time'. If called without arguments it will reset back to the default value 'linear'. Only works on chart types 'bubble', 'scatter' and 'horizontalBar'.
chart:setYAxisType( [type|nil] )stringSame as chart:setXAxisType() but for the y axis. Only works on chart types 'line', 'bubble', 'scatter' and 'bar'.
chart:setOptions( options )tableSets options using Chart.js format but makes sure you only change the given settings and not accidentally delete already existing settings. i.e. using chart:setOptions{ options = {scales = {ticks = {max = 100}}} } while {options = {scales = {ticks = {min = 0}}}} already exists will result in {options = {scales = {ticks = {min = 0, max = 100}}}}.
chart:makeMwLoadDataCompatible()N/AStrips metatables so that it can be loaded by mw.loadData()making it possible to display the table using {{Chart data|<module name>}}. This should only be used at the very end when you are done creating your chart.
chart:newDataSet( [options] )tableReturns a new dataSet object which is also automatically added to the chart datasets table.
dataSet:addData( data )tableAppends the values of data to the already existing data stored in the dataSet.data array. Using dataset.data = data will overwrite any stored data.
dataSet:addDataPoint( data )number/tableAppend a single value to the dataSet.data array. Same as table.insert( dataSet.data, data ).
dataSet:setOptions( options )tableSets options using Chart.js format.
Example:
local p = {}
local chart = require( 'Module:Chart data' )

-- This chart can then be added to a page using {{Chart data|<module name>}}
function p.pie()
    local plot = chart.newChart{ type = 'pie' }
    plot:setDimensions( '40vw', nil, 400, nil, true ) -- Pie chart is always square
    plot.colorPallet = chart.colorPallets.green
    local labels = {}
    local set = plot:newDataSet()

    for i = 1, 6 do
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end

return p.pie()

-------------------------------------------------------------
local p = {}
local chart = require( 'Module:Chart data' )

-- This chart cound be used by another module or drawn using {{#Invoke:<module name>|bar}}
function p.bar()
    local plot = chart.newChart{ type = 'bar' }
    plot:setDimensions( '40%', 600, 400, 400, true )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )

    for i = 1, 2 do
        local set = plot:newDataSet()
        for j = 1, 6 do
            set:addDataPoint( math.sqrt( i*j ) )
        end
        set.label = 'Set ' .. i

        if i == 1 then
            set.color = chart.colorPallets.green[3]
        else
            set.color = chart.colorPallets.orange[3]
        end
    end

    local labels = {}

    for i = 1, 6 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot
end

return p

Usage

To create a chart we need to create JSON in a format described by chart.js. To make this a bit easier we can write a lua table instead which is then converted to a JSON using chart._main(). An example of this is Module:Chart data/xp chart, which can then be displayed on a page using {{Chart data|Chart data/xp chart|height=40vh|width=40vw}} resulting in:

{"type":"scatter","data":{"datasets":[{"data":[{"y":0,"x":1},{"y":83,"x":2},{"y":174,"x":3},{"y":276,"x":4},{"y":388,"x":5},{"y":512,"x":6},{"y":650,"x":7},{"y":801,"x":8},{"y":969,"x":9},{"y":1154,"x":10},{"y":1358,"x":11},{"y":1584,"x":12},{"y":1833,"x":13},{"y":2107,"x":14},{"y":2411,"x":15},{"y":2746,"x":16},{"y":3115,"x":17},{"y":3523,"x":18},{"y":3973,"x":19},{"y":4470,"x":20},{"y":5018,"x":21},{"y":5624,"x":22},{"y":6291,"x":23},{"y":7028,"x":24},{"y":7842,"x":25},{"y":8740,"x":26},{"y":9730,"x":27},{"y":10824,"x":28},{"y":12031,"x":29},{"y":13363,"x":30},{"y":14833,"x":31},{"y":16456,"x":32},{"y":18247,"x":33},{"y":20224,"x":34},{"y":22406,"x":35},{"y":24815,"x":36},{"y":27473,"x":37},{"y":30408,"x":38},{"y":33648,"x":39},{"y":37224,"x":40},{"y":41171,"x":41},{"y":45529,"x":42},{"y":50339,"x":43},{"y":55649,"x":44},{"y":61512,"x":45},{"y":67983,"x":46},{"y":75127,"x":47},{"y":83014,"x":48},{"y":91721,"x":49},{"y":101333,"x":50},{"y":111945,"x":51},{"y":123660,"x":52},{"y":136594,"x":53},{"y":150872,"x":54},{"y":166636,"x":55},{"y":184040,"x":56},{"y":203254,"x":57},{"y":224466,"x":58},{"y":247886,"x":59},{"y":273742,"x":60},{"y":302288,"x":61},{"y":333804,"x":62},{"y":368599,"x":63},{"y":407015,"x":64},{"y":449428,"x":65},{"y":496254,"x":66},{"y":547953,"x":67},{"y":605032,"x":68},{"y":668051,"x":69},{"y":737627,"x":70},{"y":814445,"x":71},{"y":899257,"x":72},{"y":992895,"x":73},{"y":1096278,"x":74},{"y":1210421,"x":75},{"y":1336443,"x":76},{"y":1475581,"x":77},{"y":1629200,"x":78},{"y":1798808,"x":79},{"y":1986068,"x":80},{"y":2192818,"x":81},{"y":2421087,"x":82},{"y":2673114,"x":83},{"y":2951373,"x":84},{"y":3258594,"x":85},{"y":3597792,"x":86},{"y":3972294,"x":87},{"y":4385776,"x":88},{"y":4842295,"x":89},{"y":5346332,"x":90},{"y":5902831,"x":91},{"y":6517253,"x":92},{"y":7195629,"x":93},{"y":7944614,"x":94},{"y":8771558,"x":95},{"y":9684577,"x":96},{"y":10692629,"x":97},{"y":11805606,"x":98},{"y":13034431,"x":99},{"y":14391160,"x":100},{"y":15889109,"x":101},{"y":17542976,"x":102},{"y":19368992,"x":103},{"y":21385073,"x":104},{"y":23611006,"x":105},{"y":26068632,"x":106},{"y":28782069,"x":107},{"y":31777943,"x":108},{"y":35085654,"x":109},{"y":38737661,"x":110},{"y":42769801,"x":111},{"y":47221641,"x":112},{"y":52136869,"x":113},{"y":57563718,"x":114},{"y":63555443,"x":115},{"y":70170840,"x":116},{"y":77474828,"x":117},{"y":85539082,"x":118},{"y":94442737,"x":119},{"y":104273167,"x":120},{"y":115126838,"x":121},{"y":127110260,"x":122},{"y":140341028,"x":123},{"y":154948977,"x":124},{"y":171077457,"x":125},{"y":188884740,"x":126}],"label":"Standard skill","borderColor":"rgba(166,206,227,1)","showLine":true,"backgroundColor":"rgba(166,206,227,0.2)","fill":false}]},"options":{"maintainAspectRatio":false,"scales":{"y":{"ticks":{"beginAtZero":true},"scaleLabel":{"display":true,"labelString":"Experience"}},"x":{"ticks":{"beginAtZero":true},"scaleLabel":{"display":true,"labelString":"Level"}}},"tooltips":{"mode":"x","intersect":false,"position":"nearest"}}}

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.

Color pallets

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.

You can set your preferred pallet for your chart with myChart.colorPallet = chart.collorPallets.blue, in case of chart type bar of horizontalbar your can also set it per data set myDataSet.colorPallet = chart.collorPallets.orange or if you want all bars of a given set to be the same color myDataSet.color = chart.collorpallets.orange[3].

It is possible to define your own color pallet as an array of Module:Rgba objects.

The chart class has the following color opions:

  • backgroundAlpha - sets the rgba:fade() value for background colors.
  • hoverLightenValue - sets the rgba:lighten() value for when you hover over a data point.
  • hoverAlpha - sets the rgba:fade() value for when you hover over a data point.
  • hoverSaturateValue - sets the rgba:saturate() value for when you hover over a data point.

Their default value depend on the cart type but you can manually set them using:

chart:setOptions{
    backgroundAlpha = <number>,
    hoverLightenValue = <number>,
    hoverAlpha = <number>,
    hoverSaturateValue = <number>
}
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Qualitative","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(151,198,222,1)","borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(29,114,171,1)","borderColor":"rgba(31,120,180,1)","hoverBackgroundColor":"rgba(29,114,171,0.5)","backgroundColor":"rgba(31,120,180,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(169,219,124,1)","borderColor":"rgba(178,223,138,1)","hoverBackgroundColor":"rgba(169,219,124,0.5)","backgroundColor":"rgba(178,223,138,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(48,152,42,1)","borderColor":"rgba(51,160,44,1)","hoverBackgroundColor":"rgba(48,152,42,0.5)","backgroundColor":"rgba(51,160,44,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(250,135,134,1)","borderColor":"rgba(251,154,153,1)","hoverBackgroundColor":"rgba(250,135,134,0.5)","backgroundColor":"rgba(251,154,153,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(216,25,27,1)","borderColor":"rgba(227,26,28,1)","hoverBackgroundColor":"rgba(216,25,27,0.5)","backgroundColor":"rgba(227,26,28,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(253,183,93,1)","borderColor":"rgba(253,191,111,1)","hoverBackgroundColor":"rgba(253,183,93,0.5)","backgroundColor":"rgba(253,191,111,0.3)","clip":5,"fill":false},{"label":"Set 8","showLine":true,"data":[{"y":0,"x":0},{"y":8,"x":1},{"y":32,"x":2},{"y":72,"x":3},{"y":128,"x":4},{"y":200,"x":5},{"y":288,"x":6},{"y":392,"x":7},{"y":512,"x":8},{"y":648,"x":9},{"y":800,"x":10},{"y":968,"x":11},{"y":1152,"x":12},{"y":1352,"x":13},{"y":1568,"x":14},{"y":1800,"x":15},{"y":2048,"x":16},{"y":2312,"x":17},{"y":2592,"x":18},{"y":2888,"x":19},{"y":3200,"x":20},{"y":3528,"x":21},{"y":3872,"x":22},{"y":4232,"x":23},{"y":4608,"x":24},{"y":5000,"x":25},{"y":5408,"x":26},{"y":5832,"x":27},{"y":6272,"x":28},{"y":6728,"x":29},{"y":7200,"x":30},{"y":7688,"x":31},{"y":8192,"x":32},{"y":8712,"x":33},{"y":9248,"x":34},{"y":9800,"x":35},{"y":10368,"x":36},{"y":10952,"x":37},{"y":11552,"x":38},{"y":12168,"x":39},{"y":12800,"x":40},{"y":13448,"x":41},{"y":14112,"x":42},{"y":14792,"x":43},{"y":15488,"x":44},{"y":16200,"x":45},{"y":16928,"x":46},{"y":17672,"x":47},{"y":18432,"x":48},{"y":19208,"x":49},{"y":20000,"x":50}],"hoverBorderColor":"rgba(242,121,0,1)","borderColor":"rgba(255,127,0,1)","hoverBackgroundColor":"rgba(242,121,0,0.5)","backgroundColor":"rgba(255,127,0,0.3)","clip":5,"fill":false},{"label":"Set 9","showLine":true,"data":[{"y":0,"x":0},{"y":9,"x":1},{"y":36,"x":2},{"y":81,"x":3},{"y":144,"x":4},{"y":225,"x":5},{"y":324,"x":6},{"y":441,"x":7},{"y":576,"x":8},{"y":729,"x":9},{"y":900,"x":10},{"y":1089,"x":11},{"y":1296,"x":12},{"y":1521,"x":13},{"y":1764,"x":14},{"y":2025,"x":15},{"y":2304,"x":16},{"y":2601,"x":17},{"y":2916,"x":18},{"y":3249,"x":19},{"y":3600,"x":20},{"y":3969,"x":21},{"y":4356,"x":22},{"y":4761,"x":23},{"y":5184,"x":24},{"y":5625,"x":25},{"y":6084,"x":26},{"y":6561,"x":27},{"y":7056,"x":28},{"y":7569,"x":29},{"y":8100,"x":30},{"y":8649,"x":31},{"y":9216,"x":32},{"y":9801,"x":33},{"y":10404,"x":34},{"y":11025,"x":35},{"y":11664,"x":36},{"y":12321,"x":37},{"y":12996,"x":38},{"y":13689,"x":39},{"y":14400,"x":40},{"y":15129,"x":41},{"y":15876,"x":42},{"y":16641,"x":43},{"y":17424,"x":44},{"y":18225,"x":45},{"y":19044,"x":46},{"y":19881,"x":47},{"y":20736,"x":48},{"y":21609,"x":49},{"y":22500,"x":50}],"hoverBorderColor":"rgba(193,165,207,1)","borderColor":"rgba(202,178,214,1)","hoverBackgroundColor":"rgba(193,165,207,0.5)","backgroundColor":"rgba(202,178,214,0.3)","clip":5,"fill":false},{"label":"Set 10","showLine":true,"data":[{"y":0,"x":0},{"y":10,"x":1},{"y":40,"x":2},{"y":90,"x":3},{"y":160,"x":4},{"y":250,"x":5},{"y":360,"x":6},{"y":490,"x":7},{"y":640,"x":8},{"y":810,"x":9},{"y":1000,"x":10},{"y":1210,"x":11},{"y":1440,"x":12},{"y":1690,"x":13},{"y":1960,"x":14},{"y":2250,"x":15},{"y":2560,"x":16},{"y":2890,"x":17},{"y":3240,"x":18},{"y":3610,"x":19},{"y":4000,"x":20},{"y":4410,"x":21},{"y":4840,"x":22},{"y":5290,"x":23},{"y":5760,"x":24},{"y":6250,"x":25},{"y":6760,"x":26},{"y":7290,"x":27},{"y":7840,"x":28},{"y":8410,"x":29},{"y":9000,"x":30},{"y":9610,"x":31},{"y":10240,"x":32},{"y":10890,"x":33},{"y":11560,"x":34},{"y":12250,"x":35},{"y":12960,"x":36},{"y":13690,"x":37},{"y":14440,"x":38},{"y":15210,"x":39},{"y":16000,"x":40},{"y":16810,"x":41},{"y":17640,"x":42},{"y":18490,"x":43},{"y":19360,"x":44},{"y":20250,"x":45},{"y":21160,"x":46},{"y":22090,"x":47},{"y":23040,"x":48},{"y":24010,"x":49},{"y":25000,"x":50}],"hoverBorderColor":"rgba(101,58,146,1)","borderColor":"rgba(106,61,154,1)","hoverBackgroundColor":"rgba(101,58,146,0.5)","backgroundColor":"rgba(106,61,154,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorQualitative}}

function p.colorQualitative()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Qualitative' )
    plot.fill = false
    plot.colorPallet = chart.colorPallets.qualitative

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Blue","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(194,195,222,1)","borderColor":"rgba(208,209,230,1)","hoverBackgroundColor":"rgba(194,195,222,0.5)","backgroundColor":"rgba(208,209,230,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(152,179,213,1)","borderColor":"rgba(166,189,219,1)","hoverBackgroundColor":"rgba(152,179,213,0.5)","backgroundColor":"rgba(166,189,219,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(91,162,203,1)","borderColor":"rgba(103,169,207,1)","hoverBackgroundColor":"rgba(91,162,203,0.5)","backgroundColor":"rgba(103,169,207,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(51,137,182,1)","borderColor":"rgba(54,144,192,1)","hoverBackgroundColor":"rgba(51,137,182,0.5)","backgroundColor":"rgba(54,144,192,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(2,123,131,1)","borderColor":"rgba(2,129,138,1)","hoverBackgroundColor":"rgba(2,123,131,0.5)","backgroundColor":"rgba(2,129,138,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(1,103,85,1)","borderColor":"rgba(1,108,89,1)","hoverBackgroundColor":"rgba(1,103,85,0.5)","backgroundColor":"rgba(1,108,89,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(1,67,51,1)","borderColor":"rgba(1,70,54,1)","hoverBackgroundColor":"rgba(1,67,51,0.5)","backgroundColor":"rgba(1,70,54,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorBlue}}

function p.colorBlue()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Blue' )
    plot.fill = false
    plot.colorPallet = chart.colorPallets.blue

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Green","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(210,237,146,1)","borderColor":"rgba(217,240,163,1)","hoverBackgroundColor":"rgba(210,237,146,0.5)","backgroundColor":"rgba(217,240,163,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(163,217,128,1)","borderColor":"rgba(173,221,142,1)","hoverBackgroundColor":"rgba(163,217,128,0.5)","backgroundColor":"rgba(173,221,142,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(109,193,110,1)","borderColor":"rgba(120,198,121,1)","hoverBackgroundColor":"rgba(109,193,110,0.5)","backgroundColor":"rgba(120,198,121,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(62,162,88,1)","borderColor":"rgba(65,171,93,1)","hoverBackgroundColor":"rgba(62,162,88,0.5)","backgroundColor":"rgba(65,171,93,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(33,125,64,1)","borderColor":"rgba(35,132,67,1)","hoverBackgroundColor":"rgba(33,125,64,0.5)","backgroundColor":"rgba(35,132,67,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(0,99,52,1)","borderColor":"rgba(0,104,55,1)","hoverBackgroundColor":"rgba(0,99,52,0.5)","backgroundColor":"rgba(0,104,55,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(0,66,39,1)","borderColor":"rgba(0,69,41,1)","hoverBackgroundColor":"rgba(0,66,39,0.5)","backgroundColor":"rgba(0,69,41,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorGreen}}

function p.colorGreen()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Green' )
    plot.fill = false
    plot.colorPallet = chart.colorPallets.green

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"BlueGreen","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(188,230,222,1)","borderColor":"rgba(204,236,230,1)","hoverBackgroundColor":"rgba(188,230,222,0.5)","backgroundColor":"rgba(204,236,230,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(140,211,194,1)","borderColor":"rgba(153,216,201,1)","hoverBackgroundColor":"rgba(140,211,194,0.5)","backgroundColor":"rgba(153,216,201,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(91,190,158,1)","borderColor":"rgba(102,194,164,1)","hoverBackgroundColor":"rgba(91,190,158,0.5)","backgroundColor":"rgba(102,194,164,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(62,165,112,1)","borderColor":"rgba(65,174,118,1)","hoverBackgroundColor":"rgba(62,165,112,0.5)","backgroundColor":"rgba(65,174,118,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(33,132,66,1)","borderColor":"rgba(35,139,69,1)","hoverBackgroundColor":"rgba(33,132,66,0.5)","backgroundColor":"rgba(35,139,69,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(0,104,42,1)","borderColor":"rgba(0,109,44,1)","hoverBackgroundColor":"rgba(0,104,42,0.5)","backgroundColor":"rgba(0,109,44,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(0,65,26,1)","borderColor":"rgba(0,68,27,1)","hoverBackgroundColor":"rgba(0,65,26,0.5)","backgroundColor":"rgba(0,68,27,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorBlueGreen}}

function p.colorBlueGreen()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'BlueGreen' )
    plot.fill = false
    plot.colorPallet = chart.colorPallets.blueGreen

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Orange","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(254,222,125,1)","borderColor":"rgba(254,227,145,1)","hoverBackgroundColor":"rgba(254,222,125,0.5)","backgroundColor":"rgba(254,227,145,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(254,190,62,1)","borderColor":"rgba(254,196,79,1)","hoverBackgroundColor":"rgba(254,190,62,0.5)","backgroundColor":"rgba(254,196,79,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(254,146,26,1)","borderColor":"rgba(254,153,41,1)","hoverBackgroundColor":"rgba(254,146,26,0.5)","backgroundColor":"rgba(254,153,41,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(225,106,18,1)","borderColor":"rgba(236,112,20,1)","hoverBackgroundColor":"rgba(225,106,18,0.5)","backgroundColor":"rgba(236,112,20,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(194,72,2,1)","borderColor":"rgba(204,76,2,1)","hoverBackgroundColor":"rgba(194,72,2,0.5)","backgroundColor":"rgba(204,76,2,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(145,49,4,1)","borderColor":"rgba(153,52,4,1)","hoverBackgroundColor":"rgba(145,49,4,0.5)","backgroundColor":"rgba(153,52,4,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(97,35,6,1)","borderColor":"rgba(102,37,6,1)","hoverBackgroundColor":"rgba(97,35,6,0.5)","backgroundColor":"rgba(102,37,6,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorOrange}}

function p.colorOrange()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Orange' )
    plot.fill = false
    plot.colorPallet = chart.colorPallets.orange

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"legend":{"display":false},"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Color overflow","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(254,222,125,1)","borderColor":"rgba(254,227,145,1)","hoverBackgroundColor":"rgba(254,222,125,0.5)","backgroundColor":"rgba(254,227,145,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(254,190,62,1)","borderColor":"rgba(254,196,79,1)","hoverBackgroundColor":"rgba(254,190,62,0.5)","backgroundColor":"rgba(254,196,79,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(254,146,26,1)","borderColor":"rgba(254,153,41,1)","hoverBackgroundColor":"rgba(254,146,26,0.5)","backgroundColor":"rgba(254,153,41,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(225,106,18,1)","borderColor":"rgba(236,112,20,1)","hoverBackgroundColor":"rgba(225,106,18,0.5)","backgroundColor":"rgba(236,112,20,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(194,72,2,1)","borderColor":"rgba(204,76,2,1)","hoverBackgroundColor":"rgba(194,72,2,0.5)","backgroundColor":"rgba(204,76,2,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(145,49,4,1)","borderColor":"rgba(153,52,4,1)","hoverBackgroundColor":"rgba(145,49,4,0.5)","backgroundColor":"rgba(153,52,4,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(97,35,6,1)","borderColor":"rgba(102,37,6,1)","hoverBackgroundColor":"rgba(97,35,6,0.5)","backgroundColor":"rgba(102,37,6,0.3)","clip":5,"fill":false},{"label":"Set 8","showLine":true,"data":[{"y":0,"x":0},{"y":8,"x":1},{"y":32,"x":2},{"y":72,"x":3},{"y":128,"x":4},{"y":200,"x":5},{"y":288,"x":6},{"y":392,"x":7},{"y":512,"x":8},{"y":648,"x":9},{"y":800,"x":10},{"y":968,"x":11},{"y":1152,"x":12},{"y":1352,"x":13},{"y":1568,"x":14},{"y":1800,"x":15},{"y":2048,"x":16},{"y":2312,"x":17},{"y":2592,"x":18},{"y":2888,"x":19},{"y":3200,"x":20},{"y":3528,"x":21},{"y":3872,"x":22},{"y":4232,"x":23},{"y":4608,"x":24},{"y":5000,"x":25},{"y":5408,"x":26},{"y":5832,"x":27},{"y":6272,"x":28},{"y":6728,"x":29},{"y":7200,"x":30},{"y":7688,"x":31},{"y":8192,"x":32},{"y":8712,"x":33},{"y":9248,"x":34},{"y":9800,"x":35},{"y":10368,"x":36},{"y":10952,"x":37},{"y":11552,"x":38},{"y":12168,"x":39},{"y":12800,"x":40},{"y":13448,"x":41},{"y":14112,"x":42},{"y":14792,"x":43},{"y":15488,"x":44},{"y":16200,"x":45},{"y":16928,"x":46},{"y":17672,"x":47},{"y":18432,"x":48},{"y":19208,"x":49},{"y":20000,"x":50}],"hoverBorderColor":"rgba(194,195,222,1)","borderColor":"rgba(208,209,230,1)","hoverBackgroundColor":"rgba(194,195,222,0.5)","backgroundColor":"rgba(208,209,230,0.3)","clip":5,"fill":false},{"label":"Set 9","showLine":true,"data":[{"y":0,"x":0},{"y":9,"x":1},{"y":36,"x":2},{"y":81,"x":3},{"y":144,"x":4},{"y":225,"x":5},{"y":324,"x":6},{"y":441,"x":7},{"y":576,"x":8},{"y":729,"x":9},{"y":900,"x":10},{"y":1089,"x":11},{"y":1296,"x":12},{"y":1521,"x":13},{"y":1764,"x":14},{"y":2025,"x":15},{"y":2304,"x":16},{"y":2601,"x":17},{"y":2916,"x":18},{"y":3249,"x":19},{"y":3600,"x":20},{"y":3969,"x":21},{"y":4356,"x":22},{"y":4761,"x":23},{"y":5184,"x":24},{"y":5625,"x":25},{"y":6084,"x":26},{"y":6561,"x":27},{"y":7056,"x":28},{"y":7569,"x":29},{"y":8100,"x":30},{"y":8649,"x":31},{"y":9216,"x":32},{"y":9801,"x":33},{"y":10404,"x":34},{"y":11025,"x":35},{"y":11664,"x":36},{"y":12321,"x":37},{"y":12996,"x":38},{"y":13689,"x":39},{"y":14400,"x":40},{"y":15129,"x":41},{"y":15876,"x":42},{"y":16641,"x":43},{"y":17424,"x":44},{"y":18225,"x":45},{"y":19044,"x":46},{"y":19881,"x":47},{"y":20736,"x":48},{"y":21609,"x":49},{"y":22500,"x":50}],"hoverBorderColor":"rgba(152,179,213,1)","borderColor":"rgba(166,189,219,1)","hoverBackgroundColor":"rgba(152,179,213,0.5)","backgroundColor":"rgba(166,189,219,0.3)","clip":5,"fill":false},{"label":"Set 10","showLine":true,"data":[{"y":0,"x":0},{"y":10,"x":1},{"y":40,"x":2},{"y":90,"x":3},{"y":160,"x":4},{"y":250,"x":5},{"y":360,"x":6},{"y":490,"x":7},{"y":640,"x":8},{"y":810,"x":9},{"y":1000,"x":10},{"y":1210,"x":11},{"y":1440,"x":12},{"y":1690,"x":13},{"y":1960,"x":14},{"y":2250,"x":15},{"y":2560,"x":16},{"y":2890,"x":17},{"y":3240,"x":18},{"y":3610,"x":19},{"y":4000,"x":20},{"y":4410,"x":21},{"y":4840,"x":22},{"y":5290,"x":23},{"y":5760,"x":24},{"y":6250,"x":25},{"y":6760,"x":26},{"y":7290,"x":27},{"y":7840,"x":28},{"y":8410,"x":29},{"y":9000,"x":30},{"y":9610,"x":31},{"y":10240,"x":32},{"y":10890,"x":33},{"y":11560,"x":34},{"y":12250,"x":35},{"y":12960,"x":36},{"y":13690,"x":37},{"y":14440,"x":38},{"y":15210,"x":39},{"y":16000,"x":40},{"y":16810,"x":41},{"y":17640,"x":42},{"y":18490,"x":43},{"y":19360,"x":44},{"y":20250,"x":45},{"y":21160,"x":46},{"y":22090,"x":47},{"y":23040,"x":48},{"y":24010,"x":49},{"y":25000,"x":50}],"hoverBorderColor":"rgba(91,162,203,1)","borderColor":"rgba(103,169,207,1)","hoverBackgroundColor":"rgba(91,162,203,0.5)","backgroundColor":"rgba(103,169,207,0.3)","clip":5,"fill":false},{"label":"Set 11","showLine":true,"data":[{"y":0,"x":0},{"y":11,"x":1},{"y":44,"x":2},{"y":99,"x":3},{"y":176,"x":4},{"y":275,"x":5},{"y":396,"x":6},{"y":539,"x":7},{"y":704,"x":8},{"y":891,"x":9},{"y":1100,"x":10},{"y":1331,"x":11},{"y":1584,"x":12},{"y":1859,"x":13},{"y":2156,"x":14},{"y":2475,"x":15},{"y":2816,"x":16},{"y":3179,"x":17},{"y":3564,"x":18},{"y":3971,"x":19},{"y":4400,"x":20},{"y":4851,"x":21},{"y":5324,"x":22},{"y":5819,"x":23},{"y":6336,"x":24},{"y":6875,"x":25},{"y":7436,"x":26},{"y":8019,"x":27},{"y":8624,"x":28},{"y":9251,"x":29},{"y":9900,"x":30},{"y":10571,"x":31},{"y":11264,"x":32},{"y":11979,"x":33},{"y":12716,"x":34},{"y":13475,"x":35},{"y":14256,"x":36},{"y":15059,"x":37},{"y":15884,"x":38},{"y":16731,"x":39},{"y":17600,"x":40},{"y":18491,"x":41},{"y":19404,"x":42},{"y":20339,"x":43},{"y":21296,"x":44},{"y":22275,"x":45},{"y":23276,"x":46},{"y":24299,"x":47},{"y":25344,"x":48},{"y":26411,"x":49},{"y":27500,"x":50}],"hoverBorderColor":"rgba(51,137,182,1)","borderColor":"rgba(54,144,192,1)","hoverBackgroundColor":"rgba(51,137,182,0.5)","backgroundColor":"rgba(54,144,192,0.3)","clip":5,"fill":false},{"label":"Set 12","showLine":true,"data":[{"y":0,"x":0},{"y":12,"x":1},{"y":48,"x":2},{"y":108,"x":3},{"y":192,"x":4},{"y":300,"x":5},{"y":432,"x":6},{"y":588,"x":7},{"y":768,"x":8},{"y":972,"x":9},{"y":1200,"x":10},{"y":1452,"x":11},{"y":1728,"x":12},{"y":2028,"x":13},{"y":2352,"x":14},{"y":2700,"x":15},{"y":3072,"x":16},{"y":3468,"x":17},{"y":3888,"x":18},{"y":4332,"x":19},{"y":4800,"x":20},{"y":5292,"x":21},{"y":5808,"x":22},{"y":6348,"x":23},{"y":6912,"x":24},{"y":7500,"x":25},{"y":8112,"x":26},{"y":8748,"x":27},{"y":9408,"x":28},{"y":10092,"x":29},{"y":10800,"x":30},{"y":11532,"x":31},{"y":12288,"x":32},{"y":13068,"x":33},{"y":13872,"x":34},{"y":14700,"x":35},{"y":15552,"x":36},{"y":16428,"x":37},{"y":17328,"x":38},{"y":18252,"x":39},{"y":19200,"x":40},{"y":20172,"x":41},{"y":21168,"x":42},{"y":22188,"x":43},{"y":23232,"x":44},{"y":24300,"x":45},{"y":25392,"x":46},{"y":26508,"x":47},{"y":27648,"x":48},{"y":28812,"x":49},{"y":30000,"x":50}],"hoverBorderColor":"rgba(2,123,131,1)","borderColor":"rgba(2,129,138,1)","hoverBackgroundColor":"rgba(2,123,131,0.5)","backgroundColor":"rgba(2,129,138,0.3)","clip":5,"fill":false},{"label":"Set 13","showLine":true,"data":[{"y":0,"x":0},{"y":13,"x":1},{"y":52,"x":2},{"y":117,"x":3},{"y":208,"x":4},{"y":325,"x":5},{"y":468,"x":6},{"y":637,"x":7},{"y":832,"x":8},{"y":1053,"x":9},{"y":1300,"x":10},{"y":1573,"x":11},{"y":1872,"x":12},{"y":2197,"x":13},{"y":2548,"x":14},{"y":2925,"x":15},{"y":3328,"x":16},{"y":3757,"x":17},{"y":4212,"x":18},{"y":4693,"x":19},{"y":5200,"x":20},{"y":5733,"x":21},{"y":6292,"x":22},{"y":6877,"x":23},{"y":7488,"x":24},{"y":8125,"x":25},{"y":8788,"x":26},{"y":9477,"x":27},{"y":10192,"x":28},{"y":10933,"x":29},{"y":11700,"x":30},{"y":12493,"x":31},{"y":13312,"x":32},{"y":14157,"x":33},{"y":15028,"x":34},{"y":15925,"x":35},{"y":16848,"x":36},{"y":17797,"x":37},{"y":18772,"x":38},{"y":19773,"x":39},{"y":20800,"x":40},{"y":21853,"x":41},{"y":22932,"x":42},{"y":24037,"x":43},{"y":25168,"x":44},{"y":26325,"x":45},{"y":27508,"x":46},{"y":28717,"x":47},{"y":29952,"x":48},{"y":31213,"x":49},{"y":32500,"x":50}],"hoverBorderColor":"rgba(1,103,85,1)","borderColor":"rgba(1,108,89,1)","hoverBackgroundColor":"rgba(1,103,85,0.5)","backgroundColor":"rgba(1,108,89,0.3)","clip":5,"fill":false},{"label":"Set 14","showLine":true,"data":[{"y":0,"x":0},{"y":14,"x":1},{"y":56,"x":2},{"y":126,"x":3},{"y":224,"x":4},{"y":350,"x":5},{"y":504,"x":6},{"y":686,"x":7},{"y":896,"x":8},{"y":1134,"x":9},{"y":1400,"x":10},{"y":1694,"x":11},{"y":2016,"x":12},{"y":2366,"x":13},{"y":2744,"x":14},{"y":3150,"x":15},{"y":3584,"x":16},{"y":4046,"x":17},{"y":4536,"x":18},{"y":5054,"x":19},{"y":5600,"x":20},{"y":6174,"x":21},{"y":6776,"x":22},{"y":7406,"x":23},{"y":8064,"x":24},{"y":8750,"x":25},{"y":9464,"x":26},{"y":10206,"x":27},{"y":10976,"x":28},{"y":11774,"x":29},{"y":12600,"x":30},{"y":13454,"x":31},{"y":14336,"x":32},{"y":15246,"x":33},{"y":16184,"x":34},{"y":17150,"x":35},{"y":18144,"x":36},{"y":19166,"x":37},{"y":20216,"x":38},{"y":21294,"x":39},{"y":22400,"x":40},{"y":23534,"x":41},{"y":24696,"x":42},{"y":25886,"x":43},{"y":27104,"x":44},{"y":28350,"x":45},{"y":29624,"x":46},{"y":30926,"x":47},{"y":32256,"x":48},{"y":33614,"x":49},{"y":35000,"x":50}],"hoverBorderColor":"rgba(1,67,51,1)","borderColor":"rgba(1,70,54,1)","hoverBackgroundColor":"rgba(1,67,51,0.5)","backgroundColor":"rgba(1,70,54,0.3)","clip":5,"fill":false},{"label":"Set 15","showLine":true,"data":[{"y":0,"x":0},{"y":15,"x":1},{"y":60,"x":2},{"y":135,"x":3},{"y":240,"x":4},{"y":375,"x":5},{"y":540,"x":6},{"y":735,"x":7},{"y":960,"x":8},{"y":1215,"x":9},{"y":1500,"x":10},{"y":1815,"x":11},{"y":2160,"x":12},{"y":2535,"x":13},{"y":2940,"x":14},{"y":3375,"x":15},{"y":3840,"x":16},{"y":4335,"x":17},{"y":4860,"x":18},{"y":5415,"x":19},{"y":6000,"x":20},{"y":6615,"x":21},{"y":7260,"x":22},{"y":7935,"x":23},{"y":8640,"x":24},{"y":9375,"x":25},{"y":10140,"x":26},{"y":10935,"x":27},{"y":11760,"x":28},{"y":12615,"x":29},{"y":13500,"x":30},{"y":14415,"x":31},{"y":15360,"x":32},{"y":16335,"x":33},{"y":17340,"x":34},{"y":18375,"x":35},{"y":19440,"x":36},{"y":20535,"x":37},{"y":21660,"x":38},{"y":22815,"x":39},{"y":24000,"x":40},{"y":25215,"x":41},{"y":26460,"x":42},{"y":27735,"x":43},{"y":29040,"x":44},{"y":30375,"x":45},{"y":31740,"x":46},{"y":33135,"x":47},{"y":34560,"x":48},{"y":36015,"x":49},{"y":37500,"x":50}],"hoverBorderColor":"rgba(188,230,222,1)","borderColor":"rgba(204,236,230,1)","hoverBackgroundColor":"rgba(188,230,222,0.5)","backgroundColor":"rgba(204,236,230,0.3)","clip":5,"fill":false},{"label":"Set 16","showLine":true,"data":[{"y":0,"x":0},{"y":16,"x":1},{"y":64,"x":2},{"y":144,"x":3},{"y":256,"x":4},{"y":400,"x":5},{"y":576,"x":6},{"y":784,"x":7},{"y":1024,"x":8},{"y":1296,"x":9},{"y":1600,"x":10},{"y":1936,"x":11},{"y":2304,"x":12},{"y":2704,"x":13},{"y":3136,"x":14},{"y":3600,"x":15},{"y":4096,"x":16},{"y":4624,"x":17},{"y":5184,"x":18},{"y":5776,"x":19},{"y":6400,"x":20},{"y":7056,"x":21},{"y":7744,"x":22},{"y":8464,"x":23},{"y":9216,"x":24},{"y":10000,"x":25},{"y":10816,"x":26},{"y":11664,"x":27},{"y":12544,"x":28},{"y":13456,"x":29},{"y":14400,"x":30},{"y":15376,"x":31},{"y":16384,"x":32},{"y":17424,"x":33},{"y":18496,"x":34},{"y":19600,"x":35},{"y":20736,"x":36},{"y":21904,"x":37},{"y":23104,"x":38},{"y":24336,"x":39},{"y":25600,"x":40},{"y":26896,"x":41},{"y":28224,"x":42},{"y":29584,"x":43},{"y":30976,"x":44},{"y":32400,"x":45},{"y":33856,"x":46},{"y":35344,"x":47},{"y":36864,"x":48},{"y":38416,"x":49},{"y":40000,"x":50}],"hoverBorderColor":"rgba(140,211,194,1)","borderColor":"rgba(153,216,201,1)","hoverBackgroundColor":"rgba(140,211,194,0.5)","backgroundColor":"rgba(153,216,201,0.3)","clip":5,"fill":false},{"label":"Set 17","showLine":true,"data":[{"y":0,"x":0},{"y":17,"x":1},{"y":68,"x":2},{"y":153,"x":3},{"y":272,"x":4},{"y":425,"x":5},{"y":612,"x":6},{"y":833,"x":7},{"y":1088,"x":8},{"y":1377,"x":9},{"y":1700,"x":10},{"y":2057,"x":11},{"y":2448,"x":12},{"y":2873,"x":13},{"y":3332,"x":14},{"y":3825,"x":15},{"y":4352,"x":16},{"y":4913,"x":17},{"y":5508,"x":18},{"y":6137,"x":19},{"y":6800,"x":20},{"y":7497,"x":21},{"y":8228,"x":22},{"y":8993,"x":23},{"y":9792,"x":24},{"y":10625,"x":25},{"y":11492,"x":26},{"y":12393,"x":27},{"y":13328,"x":28},{"y":14297,"x":29},{"y":15300,"x":30},{"y":16337,"x":31},{"y":17408,"x":32},{"y":18513,"x":33},{"y":19652,"x":34},{"y":20825,"x":35},{"y":22032,"x":36},{"y":23273,"x":37},{"y":24548,"x":38},{"y":25857,"x":39},{"y":27200,"x":40},{"y":28577,"x":41},{"y":29988,"x":42},{"y":31433,"x":43},{"y":32912,"x":44},{"y":34425,"x":45},{"y":35972,"x":46},{"y":37553,"x":47},{"y":39168,"x":48},{"y":40817,"x":49},{"y":42500,"x":50}],"hoverBorderColor":"rgba(91,190,158,1)","borderColor":"rgba(102,194,164,1)","hoverBackgroundColor":"rgba(91,190,158,0.5)","backgroundColor":"rgba(102,194,164,0.3)","clip":5,"fill":false},{"label":"Set 18","showLine":true,"data":[{"y":0,"x":0},{"y":18,"x":1},{"y":72,"x":2},{"y":162,"x":3},{"y":288,"x":4},{"y":450,"x":5},{"y":648,"x":6},{"y":882,"x":7},{"y":1152,"x":8},{"y":1458,"x":9},{"y":1800,"x":10},{"y":2178,"x":11},{"y":2592,"x":12},{"y":3042,"x":13},{"y":3528,"x":14},{"y":4050,"x":15},{"y":4608,"x":16},{"y":5202,"x":17},{"y":5832,"x":18},{"y":6498,"x":19},{"y":7200,"x":20},{"y":7938,"x":21},{"y":8712,"x":22},{"y":9522,"x":23},{"y":10368,"x":24},{"y":11250,"x":25},{"y":12168,"x":26},{"y":13122,"x":27},{"y":14112,"x":28},{"y":15138,"x":29},{"y":16200,"x":30},{"y":17298,"x":31},{"y":18432,"x":32},{"y":19602,"x":33},{"y":20808,"x":34},{"y":22050,"x":35},{"y":23328,"x":36},{"y":24642,"x":37},{"y":25992,"x":38},{"y":27378,"x":39},{"y":28800,"x":40},{"y":30258,"x":41},{"y":31752,"x":42},{"y":33282,"x":43},{"y":34848,"x":44},{"y":36450,"x":45},{"y":38088,"x":46},{"y":39762,"x":47},{"y":41472,"x":48},{"y":43218,"x":49},{"y":45000,"x":50}],"hoverBorderColor":"rgba(62,165,112,1)","borderColor":"rgba(65,174,118,1)","hoverBackgroundColor":"rgba(62,165,112,0.5)","backgroundColor":"rgba(65,174,118,0.3)","clip":5,"fill":false},{"label":"Set 19","showLine":true,"data":[{"y":0,"x":0},{"y":19,"x":1},{"y":76,"x":2},{"y":171,"x":3},{"y":304,"x":4},{"y":475,"x":5},{"y":684,"x":6},{"y":931,"x":7},{"y":1216,"x":8},{"y":1539,"x":9},{"y":1900,"x":10},{"y":2299,"x":11},{"y":2736,"x":12},{"y":3211,"x":13},{"y":3724,"x":14},{"y":4275,"x":15},{"y":4864,"x":16},{"y":5491,"x":17},{"y":6156,"x":18},{"y":6859,"x":19},{"y":7600,"x":20},{"y":8379,"x":21},{"y":9196,"x":22},{"y":10051,"x":23},{"y":10944,"x":24},{"y":11875,"x":25},{"y":12844,"x":26},{"y":13851,"x":27},{"y":14896,"x":28},{"y":15979,"x":29},{"y":17100,"x":30},{"y":18259,"x":31},{"y":19456,"x":32},{"y":20691,"x":33},{"y":21964,"x":34},{"y":23275,"x":35},{"y":24624,"x":36},{"y":26011,"x":37},{"y":27436,"x":38},{"y":28899,"x":39},{"y":30400,"x":40},{"y":31939,"x":41},{"y":33516,"x":42},{"y":35131,"x":43},{"y":36784,"x":44},{"y":38475,"x":45},{"y":40204,"x":46},{"y":41971,"x":47},{"y":43776,"x":48},{"y":45619,"x":49},{"y":47500,"x":50}],"hoverBorderColor":"rgba(33,132,66,1)","borderColor":"rgba(35,139,69,1)","hoverBackgroundColor":"rgba(33,132,66,0.5)","backgroundColor":"rgba(35,139,69,0.3)","clip":5,"fill":false},{"label":"Set 20","showLine":true,"data":[{"y":0,"x":0},{"y":20,"x":1},{"y":80,"x":2},{"y":180,"x":3},{"y":320,"x":4},{"y":500,"x":5},{"y":720,"x":6},{"y":980,"x":7},{"y":1280,"x":8},{"y":1620,"x":9},{"y":2000,"x":10},{"y":2420,"x":11},{"y":2880,"x":12},{"y":3380,"x":13},{"y":3920,"x":14},{"y":4500,"x":15},{"y":5120,"x":16},{"y":5780,"x":17},{"y":6480,"x":18},{"y":7220,"x":19},{"y":8000,"x":20},{"y":8820,"x":21},{"y":9680,"x":22},{"y":10580,"x":23},{"y":11520,"x":24},{"y":12500,"x":25},{"y":13520,"x":26},{"y":14580,"x":27},{"y":15680,"x":28},{"y":16820,"x":29},{"y":18000,"x":30},{"y":19220,"x":31},{"y":20480,"x":32},{"y":21780,"x":33},{"y":23120,"x":34},{"y":24500,"x":35},{"y":25920,"x":36},{"y":27380,"x":37},{"y":28880,"x":38},{"y":30420,"x":39},{"y":32000,"x":40},{"y":33620,"x":41},{"y":35280,"x":42},{"y":36980,"x":43},{"y":38720,"x":44},{"y":40500,"x":45},{"y":42320,"x":46},{"y":44180,"x":47},{"y":46080,"x":48},{"y":48020,"x":49},{"y":50000,"x":50}],"hoverBorderColor":"rgba(0,104,42,1)","borderColor":"rgba(0,109,44,1)","hoverBackgroundColor":"rgba(0,104,42,0.5)","backgroundColor":"rgba(0,109,44,0.3)","clip":5,"fill":false},{"label":"Set 21","showLine":true,"data":[{"y":0,"x":0},{"y":21,"x":1},{"y":84,"x":2},{"y":189,"x":3},{"y":336,"x":4},{"y":525,"x":5},{"y":756,"x":6},{"y":1029,"x":7},{"y":1344,"x":8},{"y":1701,"x":9},{"y":2100,"x":10},{"y":2541,"x":11},{"y":3024,"x":12},{"y":3549,"x":13},{"y":4116,"x":14},{"y":4725,"x":15},{"y":5376,"x":16},{"y":6069,"x":17},{"y":6804,"x":18},{"y":7581,"x":19},{"y":8400,"x":20},{"y":9261,"x":21},{"y":10164,"x":22},{"y":11109,"x":23},{"y":12096,"x":24},{"y":13125,"x":25},{"y":14196,"x":26},{"y":15309,"x":27},{"y":16464,"x":28},{"y":17661,"x":29},{"y":18900,"x":30},{"y":20181,"x":31},{"y":21504,"x":32},{"y":22869,"x":33},{"y":24276,"x":34},{"y":25725,"x":35},{"y":27216,"x":36},{"y":28749,"x":37},{"y":30324,"x":38},{"y":31941,"x":39},{"y":33600,"x":40},{"y":35301,"x":41},{"y":37044,"x":42},{"y":38829,"x":43},{"y":40656,"x":44},{"y":42525,"x":45},{"y":44436,"x":46},{"y":46389,"x":47},{"y":48384,"x":48},{"y":50421,"x":49},{"y":52500,"x":50}],"hoverBorderColor":"rgba(0,65,26,1)","borderColor":"rgba(0,68,27,1)","hoverBackgroundColor":"rgba(0,65,26,0.5)","backgroundColor":"rgba(0,68,27,0.3)","clip":5,"fill":false},{"label":"Set 22","showLine":true,"data":[{"y":0,"x":0},{"y":22,"x":1},{"y":88,"x":2},{"y":198,"x":3},{"y":352,"x":4},{"y":550,"x":5},{"y":792,"x":6},{"y":1078,"x":7},{"y":1408,"x":8},{"y":1782,"x":9},{"y":2200,"x":10},{"y":2662,"x":11},{"y":3168,"x":12},{"y":3718,"x":13},{"y":4312,"x":14},{"y":4950,"x":15},{"y":5632,"x":16},{"y":6358,"x":17},{"y":7128,"x":18},{"y":7942,"x":19},{"y":8800,"x":20},{"y":9702,"x":21},{"y":10648,"x":22},{"y":11638,"x":23},{"y":12672,"x":24},{"y":13750,"x":25},{"y":14872,"x":26},{"y":16038,"x":27},{"y":17248,"x":28},{"y":18502,"x":29},{"y":19800,"x":30},{"y":21142,"x":31},{"y":22528,"x":32},{"y":23958,"x":33},{"y":25432,"x":34},{"y":26950,"x":35},{"y":28512,"x":36},{"y":30118,"x":37},{"y":31768,"x":38},{"y":33462,"x":39},{"y":35200,"x":40},{"y":36982,"x":41},{"y":38808,"x":42},{"y":40678,"x":43},{"y":42592,"x":44},{"y":44550,"x":45},{"y":46552,"x":46},{"y":48598,"x":47},{"y":50688,"x":48},{"y":52822,"x":49},{"y":55000,"x":50}],"hoverBorderColor":"rgba(151,198,222,1)","borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.3)","clip":5,"fill":false},{"label":"Set 23","showLine":true,"data":[{"y":0,"x":0},{"y":23,"x":1},{"y":92,"x":2},{"y":207,"x":3},{"y":368,"x":4},{"y":575,"x":5},{"y":828,"x":6},{"y":1127,"x":7},{"y":1472,"x":8},{"y":1863,"x":9},{"y":2300,"x":10},{"y":2783,"x":11},{"y":3312,"x":12},{"y":3887,"x":13},{"y":4508,"x":14},{"y":5175,"x":15},{"y":5888,"x":16},{"y":6647,"x":17},{"y":7452,"x":18},{"y":8303,"x":19},{"y":9200,"x":20},{"y":10143,"x":21},{"y":11132,"x":22},{"y":12167,"x":23},{"y":13248,"x":24},{"y":14375,"x":25},{"y":15548,"x":26},{"y":16767,"x":27},{"y":18032,"x":28},{"y":19343,"x":29},{"y":20700,"x":30},{"y":22103,"x":31},{"y":23552,"x":32},{"y":25047,"x":33},{"y":26588,"x":34},{"y":28175,"x":35},{"y":29808,"x":36},{"y":31487,"x":37},{"y":33212,"x":38},{"y":34983,"x":39},{"y":36800,"x":40},{"y":38663,"x":41},{"y":40572,"x":42},{"y":42527,"x":43},{"y":44528,"x":44},{"y":46575,"x":45},{"y":48668,"x":46},{"y":50807,"x":47},{"y":52992,"x":48},{"y":55223,"x":49},{"y":57500,"x":50}],"hoverBorderColor":"rgba(29,114,171,1)","borderColor":"rgba(31,120,180,1)","hoverBackgroundColor":"rgba(29,114,171,0.5)","backgroundColor":"rgba(31,120,180,0.3)","clip":5,"fill":false},{"label":"Set 24","showLine":true,"data":[{"y":0,"x":0},{"y":24,"x":1},{"y":96,"x":2},{"y":216,"x":3},{"y":384,"x":4},{"y":600,"x":5},{"y":864,"x":6},{"y":1176,"x":7},{"y":1536,"x":8},{"y":1944,"x":9},{"y":2400,"x":10},{"y":2904,"x":11},{"y":3456,"x":12},{"y":4056,"x":13},{"y":4704,"x":14},{"y":5400,"x":15},{"y":6144,"x":16},{"y":6936,"x":17},{"y":7776,"x":18},{"y":8664,"x":19},{"y":9600,"x":20},{"y":10584,"x":21},{"y":11616,"x":22},{"y":12696,"x":23},{"y":13824,"x":24},{"y":15000,"x":25},{"y":16224,"x":26},{"y":17496,"x":27},{"y":18816,"x":28},{"y":20184,"x":29},{"y":21600,"x":30},{"y":23064,"x":31},{"y":24576,"x":32},{"y":26136,"x":33},{"y":27744,"x":34},{"y":29400,"x":35},{"y":31104,"x":36},{"y":32856,"x":37},{"y":34656,"x":38},{"y":36504,"x":39},{"y":38400,"x":40},{"y":40344,"x":41},{"y":42336,"x":42},{"y":44376,"x":43},{"y":46464,"x":44},{"y":48600,"x":45},{"y":50784,"x":46},{"y":53016,"x":47},{"y":55296,"x":48},{"y":57624,"x":49},{"y":60000,"x":50}],"hoverBorderColor":"rgba(169,219,124,1)","borderColor":"rgba(178,223,138,1)","hoverBackgroundColor":"rgba(169,219,124,0.5)","backgroundColor":"rgba(178,223,138,0.3)","clip":5,"fill":false},{"label":"Set 25","showLine":true,"data":[{"y":0,"x":0},{"y":25,"x":1},{"y":100,"x":2},{"y":225,"x":3},{"y":400,"x":4},{"y":625,"x":5},{"y":900,"x":6},{"y":1225,"x":7},{"y":1600,"x":8},{"y":2025,"x":9},{"y":2500,"x":10},{"y":3025,"x":11},{"y":3600,"x":12},{"y":4225,"x":13},{"y":4900,"x":14},{"y":5625,"x":15},{"y":6400,"x":16},{"y":7225,"x":17},{"y":8100,"x":18},{"y":9025,"x":19},{"y":10000,"x":20},{"y":11025,"x":21},{"y":12100,"x":22},{"y":13225,"x":23},{"y":14400,"x":24},{"y":15625,"x":25},{"y":16900,"x":26},{"y":18225,"x":27},{"y":19600,"x":28},{"y":21025,"x":29},{"y":22500,"x":30},{"y":24025,"x":31},{"y":25600,"x":32},{"y":27225,"x":33},{"y":28900,"x":34},{"y":30625,"x":35},{"y":32400,"x":36},{"y":34225,"x":37},{"y":36100,"x":38},{"y":38025,"x":39},{"y":40000,"x":40},{"y":42025,"x":41},{"y":44100,"x":42},{"y":46225,"x":43},{"y":48400,"x":44},{"y":50625,"x":45},{"y":52900,"x":46},{"y":55225,"x":47},{"y":57600,"x":48},{"y":60025,"x":49},{"y":62500,"x":50}],"hoverBorderColor":"rgba(48,152,42,1)","borderColor":"rgba(51,160,44,1)","hoverBackgroundColor":"rgba(48,152,42,0.5)","backgroundColor":"rgba(51,160,44,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|colorOverflow}}

function p.colorOverflow()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Color overflow' )
    plot:setOptions{
        options = {
            legend = {
                display = false
            }
        }
    }
    plot.fill = false
    plot.colorPallet = chart.colorPallets.orange

    for i = 1, 25 do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Custom color pallet","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1,"x":1},{"y":4,"x":2},{"y":9,"x":3},{"y":16,"x":4},{"y":25,"x":5},{"y":36,"x":6},{"y":49,"x":7},{"y":64,"x":8},{"y":81,"x":9},{"y":100,"x":10},{"y":121,"x":11},{"y":144,"x":12},{"y":169,"x":13},{"y":196,"x":14},{"y":225,"x":15},{"y":256,"x":16},{"y":289,"x":17},{"y":324,"x":18},{"y":361,"x":19},{"y":400,"x":20},{"y":441,"x":21},{"y":484,"x":22},{"y":529,"x":23},{"y":576,"x":24},{"y":625,"x":25},{"y":676,"x":26},{"y":729,"x":27},{"y":784,"x":28},{"y":841,"x":29},{"y":900,"x":30},{"y":961,"x":31},{"y":1024,"x":32},{"y":1089,"x":33},{"y":1156,"x":34},{"y":1225,"x":35},{"y":1296,"x":36},{"y":1369,"x":37},{"y":1444,"x":38},{"y":1521,"x":39},{"y":1600,"x":40},{"y":1681,"x":41},{"y":1764,"x":42},{"y":1849,"x":43},{"y":1936,"x":44},{"y":2025,"x":45},{"y":2116,"x":46},{"y":2209,"x":47},{"y":2304,"x":48},{"y":2401,"x":49},{"y":2500,"x":50}],"hoverBorderColor":"rgba(0,0,0,1)","borderColor":"rgba(0,0,0,1)","hoverBackgroundColor":"rgba(0,0,0,0.5)","backgroundColor":"rgba(0,0,0,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":2,"x":1},{"y":8,"x":2},{"y":18,"x":3},{"y":32,"x":4},{"y":50,"x":5},{"y":72,"x":6},{"y":98,"x":7},{"y":128,"x":8},{"y":162,"x":9},{"y":200,"x":10},{"y":242,"x":11},{"y":288,"x":12},{"y":338,"x":13},{"y":392,"x":14},{"y":450,"x":15},{"y":512,"x":16},{"y":578,"x":17},{"y":648,"x":18},{"y":722,"x":19},{"y":800,"x":20},{"y":882,"x":21},{"y":968,"x":22},{"y":1058,"x":23},{"y":1152,"x":24},{"y":1250,"x":25},{"y":1352,"x":26},{"y":1458,"x":27},{"y":1568,"x":28},{"y":1682,"x":29},{"y":1800,"x":30},{"y":1922,"x":31},{"y":2048,"x":32},{"y":2178,"x":33},{"y":2312,"x":34},{"y":2450,"x":35},{"y":2592,"x":36},{"y":2738,"x":37},{"y":2888,"x":38},{"y":3042,"x":39},{"y":3200,"x":40},{"y":3362,"x":41},{"y":3528,"x":42},{"y":3698,"x":43},{"y":3872,"x":44},{"y":4050,"x":45},{"y":4232,"x":46},{"y":4418,"x":47},{"y":4608,"x":48},{"y":4802,"x":49},{"y":5000,"x":50}],"hoverBorderColor":"rgba(120,0,0,1)","borderColor":"rgba(126,0,0,1)","hoverBackgroundColor":"rgba(120,0,0,0.5)","backgroundColor":"rgba(126,0,0,0.3)","clip":5,"fill":false},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":3,"x":1},{"y":12,"x":2},{"y":27,"x":3},{"y":48,"x":4},{"y":75,"x":5},{"y":108,"x":6},{"y":147,"x":7},{"y":192,"x":8},{"y":243,"x":9},{"y":300,"x":10},{"y":363,"x":11},{"y":432,"x":12},{"y":507,"x":13},{"y":588,"x":14},{"y":675,"x":15},{"y":768,"x":16},{"y":867,"x":17},{"y":972,"x":18},{"y":1083,"x":19},{"y":1200,"x":20},{"y":1323,"x":21},{"y":1452,"x":22},{"y":1587,"x":23},{"y":1728,"x":24},{"y":1875,"x":25},{"y":2028,"x":26},{"y":2187,"x":27},{"y":2352,"x":28},{"y":2523,"x":29},{"y":2700,"x":30},{"y":2883,"x":31},{"y":3072,"x":32},{"y":3267,"x":33},{"y":3468,"x":34},{"y":3675,"x":35},{"y":3888,"x":36},{"y":4107,"x":37},{"y":4332,"x":38},{"y":4563,"x":39},{"y":4800,"x":40},{"y":5043,"x":41},{"y":5292,"x":42},{"y":5547,"x":43},{"y":5808,"x":44},{"y":6075,"x":45},{"y":6348,"x":46},{"y":6627,"x":47},{"y":6912,"x":48},{"y":7203,"x":49},{"y":7500,"x":50}],"hoverBorderColor":"rgba(0,120,0,1)","borderColor":"rgba(0,126,0,1)","hoverBackgroundColor":"rgba(0,120,0,0.5)","backgroundColor":"rgba(0,126,0,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":4,"x":1},{"y":16,"x":2},{"y":36,"x":3},{"y":64,"x":4},{"y":100,"x":5},{"y":144,"x":6},{"y":196,"x":7},{"y":256,"x":8},{"y":324,"x":9},{"y":400,"x":10},{"y":484,"x":11},{"y":576,"x":12},{"y":676,"x":13},{"y":784,"x":14},{"y":900,"x":15},{"y":1024,"x":16},{"y":1156,"x":17},{"y":1296,"x":18},{"y":1444,"x":19},{"y":1600,"x":20},{"y":1764,"x":21},{"y":1936,"x":22},{"y":2116,"x":23},{"y":2304,"x":24},{"y":2500,"x":25},{"y":2704,"x":26},{"y":2916,"x":27},{"y":3136,"x":28},{"y":3364,"x":29},{"y":3600,"x":30},{"y":3844,"x":31},{"y":4096,"x":32},{"y":4356,"x":33},{"y":4624,"x":34},{"y":4900,"x":35},{"y":5184,"x":36},{"y":5476,"x":37},{"y":5776,"x":38},{"y":6084,"x":39},{"y":6400,"x":40},{"y":6724,"x":41},{"y":7056,"x":42},{"y":7396,"x":43},{"y":7744,"x":44},{"y":8100,"x":45},{"y":8464,"x":46},{"y":8836,"x":47},{"y":9216,"x":48},{"y":9604,"x":49},{"y":10000,"x":50}],"hoverBorderColor":"rgba(0,0,120,1)","borderColor":"rgba(0,0,126,1)","hoverBackgroundColor":"rgba(0,0,120,0.5)","backgroundColor":"rgba(0,0,126,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":5,"x":1},{"y":20,"x":2},{"y":45,"x":3},{"y":80,"x":4},{"y":125,"x":5},{"y":180,"x":6},{"y":245,"x":7},{"y":320,"x":8},{"y":405,"x":9},{"y":500,"x":10},{"y":605,"x":11},{"y":720,"x":12},{"y":845,"x":13},{"y":980,"x":14},{"y":1125,"x":15},{"y":1280,"x":16},{"y":1445,"x":17},{"y":1620,"x":18},{"y":1805,"x":19},{"y":2000,"x":20},{"y":2205,"x":21},{"y":2420,"x":22},{"y":2645,"x":23},{"y":2880,"x":24},{"y":3125,"x":25},{"y":3380,"x":26},{"y":3645,"x":27},{"y":3920,"x":28},{"y":4205,"x":29},{"y":4500,"x":30},{"y":4805,"x":31},{"y":5120,"x":32},{"y":5445,"x":33},{"y":5780,"x":34},{"y":6125,"x":35},{"y":6480,"x":36},{"y":6845,"x":37},{"y":7220,"x":38},{"y":7605,"x":39},{"y":8000,"x":40},{"y":8405,"x":41},{"y":8820,"x":42},{"y":9245,"x":43},{"y":9680,"x":44},{"y":10125,"x":45},{"y":10580,"x":46},{"y":11045,"x":47},{"y":11520,"x":48},{"y":12005,"x":49},{"y":12500,"x":50}],"hoverBorderColor":"rgba(242,0,0,1)","borderColor":"rgba(255,0,0,1)","hoverBackgroundColor":"rgba(242,0,0,0.5)","backgroundColor":"rgba(255,0,0,0.3)","clip":5,"fill":false},{"label":"Set 6","showLine":true,"data":[{"y":0,"x":0},{"y":6,"x":1},{"y":24,"x":2},{"y":54,"x":3},{"y":96,"x":4},{"y":150,"x":5},{"y":216,"x":6},{"y":294,"x":7},{"y":384,"x":8},{"y":486,"x":9},{"y":600,"x":10},{"y":726,"x":11},{"y":864,"x":12},{"y":1014,"x":13},{"y":1176,"x":14},{"y":1350,"x":15},{"y":1536,"x":16},{"y":1734,"x":17},{"y":1944,"x":18},{"y":2166,"x":19},{"y":2400,"x":20},{"y":2646,"x":21},{"y":2904,"x":22},{"y":3174,"x":23},{"y":3456,"x":24},{"y":3750,"x":25},{"y":4056,"x":26},{"y":4374,"x":27},{"y":4704,"x":28},{"y":5046,"x":29},{"y":5400,"x":30},{"y":5766,"x":31},{"y":6144,"x":32},{"y":6534,"x":33},{"y":6936,"x":34},{"y":7350,"x":35},{"y":7776,"x":36},{"y":8214,"x":37},{"y":8664,"x":38},{"y":9126,"x":39},{"y":9600,"x":40},{"y":10086,"x":41},{"y":10584,"x":42},{"y":11094,"x":43},{"y":11616,"x":44},{"y":12150,"x":45},{"y":12696,"x":46},{"y":13254,"x":47},{"y":13824,"x":48},{"y":14406,"x":49},{"y":15000,"x":50}],"hoverBorderColor":"rgba(0,242,0,1)","borderColor":"rgba(0,255,0,1)","hoverBackgroundColor":"rgba(0,242,0,0.5)","backgroundColor":"rgba(0,255,0,0.3)","clip":5,"fill":false},{"label":"Set 7","showLine":true,"data":[{"y":0,"x":0},{"y":7,"x":1},{"y":28,"x":2},{"y":63,"x":3},{"y":112,"x":4},{"y":175,"x":5},{"y":252,"x":6},{"y":343,"x":7},{"y":448,"x":8},{"y":567,"x":9},{"y":700,"x":10},{"y":847,"x":11},{"y":1008,"x":12},{"y":1183,"x":13},{"y":1372,"x":14},{"y":1575,"x":15},{"y":1792,"x":16},{"y":2023,"x":17},{"y":2268,"x":18},{"y":2527,"x":19},{"y":2800,"x":20},{"y":3087,"x":21},{"y":3388,"x":22},{"y":3703,"x":23},{"y":4032,"x":24},{"y":4375,"x":25},{"y":4732,"x":26},{"y":5103,"x":27},{"y":5488,"x":28},{"y":5887,"x":29},{"y":6300,"x":30},{"y":6727,"x":31},{"y":7168,"x":32},{"y":7623,"x":33},{"y":8092,"x":34},{"y":8575,"x":35},{"y":9072,"x":36},{"y":9583,"x":37},{"y":10108,"x":38},{"y":10647,"x":39},{"y":11200,"x":40},{"y":11767,"x":41},{"y":12348,"x":42},{"y":12943,"x":43},{"y":13552,"x":44},{"y":14175,"x":45},{"y":14812,"x":46},{"y":15463,"x":47},{"y":16128,"x":48},{"y":16807,"x":49},{"y":17500,"x":50}],"hoverBorderColor":"rgba(0,0,242,1)","borderColor":"rgba(0,0,255,1)","hoverBackgroundColor":"rgba(0,0,242,0.5)","backgroundColor":"rgba(0,0,255,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|customColorPallet}}

function p.customColorPallet()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Custom color pallet' )
    plot.fill = false
    plot.colorPallet = {
        chart.rgba.new(0,0,0),
        chart.rgba.new(126,0,0),
        chart.rgba.new(0,126,0),
        chart.rgba.new(0,0,126),
        chart.rgba.new(255,0,0),
        chart.rgba.new(0,255,0),
        chart.rgba.new(0,0,255),
    }

    for i = 1, #plot.colorPallet do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return i*x^2 end, 0, 50 )
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"bar","options":{"tooltips":{"intersect":false},"scales":{"y":{"ticks":{"beginAtZero":true}},"x":{"ticks":{"beginAtZero":true}}},"title":{"display":true,"font":{"size":18},"text":"Color options","position":"top"},"aspectRatio":1,"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"label":"Set 1","data":[1,1.4142135623730951,1.7320508075688772,2,2.23606797749979,2.449489742783178],"hoverBackgroundColor":"rgba(31,128,32,0.4)","backgroundColor":"rgba(120,198,121,0.8)","borderColor":"rgba(120,198,121,1)","hoverBorderColor":"rgba(31,128,32,1)","color":"rgba(120,198,121,1)","clip":5,"borderWidth":1},{"label":"Set 2","data":[1.4142135623730951,2,2.449489742783178,2.8284271247461903,3.1622776601683795,3.4641016151377544],"hoverBackgroundColor":"rgba(148,78,0,0.4)","backgroundColor":"rgba(254,153,41,0.8)","borderColor":"rgba(254,153,41,1)","hoverBorderColor":"rgba(148,78,0,1)","color":"rgba(254,153,41,1)","clip":5,"borderWidth":1}]}}
Code

{{Chart data|Chart data/doc examples|colorOptions}}

function p.colorOptions()
    local plot = chart.newChart{ type = 'bar' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Color options' )
    plot:setOptions{
        backgroundAlpha = 0.8,
        hoverLightenValue = 0.5,
        hoverAlpha = 0.4,
        hoverSaturateValue = 1.5,
    }

    for i = 1, 2 do
        local set = plot:newDataSet()
        for j = 1, 6 do
            set:addDataPoint( math.sqrt( i*j ) )
        end
        set.label = 'Set ' .. i

        if i == 1 then
            set.color = chart.colorPallets.green[3]
        else
            set.color = chart.colorPallets.orange[3]
        end
    end

    local labels = {}

    for i = 1, 6 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end

Examples

Prefix text message
{"type":"line","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Line chart","position":"top"},"scales":{"y":{"scaleLabel":{"display":true,"labelString":"y axis label"}},"x":{"scaleLabel":{"display":true,"labelString":"x axis label"}}},"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5"],"datasets":[{"label":"Set 1","data":[1,4,9,10,25],"hoverBorderColor":"rgba(151,198,222,1)","borderDash":[5,5],"borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.3)","clip":5,"fill":true},{"label":"Set 2","data":[4,9,16,11,36],"hoverBorderColor":"rgba(29,114,171,1)","borderDash":[5,5],"borderColor":"rgba(31,120,180,1)","hoverBackgroundColor":"rgba(29,114,171,0.5)","backgroundColor":"rgba(31,120,180,0.3)","clip":5,"fill":true}]}}
Affix text message
Code

{{#Invoke:Chart data/doc examples|line}}

function p.line()
    local plot = chart.newChart{ type = 'line' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Line chart' )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )

    for i = 1, 2 do
        local set = plot:newDataSet()
        set.data = { i^2, (i+1)^2, (i+2)^2, (i+3^2), (i+4)^2 }
        set.label = 'Set ' .. i
        set.borderDash = {5, 5}
    end

    local labels = {}

    for i = 1, 5 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return 'Prefix text message' .. plot .. 'Affix text message'
end
{"type":"bar","options":{"tooltips":{"intersect":false},"scales":{"y":{"scaleLabel":{"display":true,"labelString":"y axis label"},"ticks":{"beginAtZero":true}},"x":{"scaleLabel":{"display":true,"labelString":"x axis label"},"ticks":{"beginAtZero":true}}},"title":{"display":true,"font":{"size":18},"text":"Bar chart","position":"top"},"aspectRatio":1,"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"label":"Set 1","data":[1,1.4142135623730951,1.7320508075688772,2,2.23606797749979,2.449489742783178],"hoverBackgroundColor":"rgba(109,193,110,0.5)","backgroundColor":"rgba(120,198,121,0.4)","borderColor":"rgba(120,198,121,1)","hoverBorderColor":"rgba(109,193,110,1)","color":"rgba(120,198,121,1)","clip":5,"borderWidth":1},{"label":"Set 2","data":[1.4142135623730951,2,2.449489742783178,2.8284271247461903,3.1622776601683795,3.4641016151377544],"hoverBackgroundColor":"rgba(254,146,26,0.5)","backgroundColor":"rgba(254,153,41,0.4)","borderColor":"rgba(254,153,41,1)","hoverBorderColor":"rgba(254,146,26,1)","color":"rgba(254,153,41,1)","clip":5,"borderWidth":1}]}}
Code

{{Chart data|Chart data/doc examples|bar}}

function p.bar()
    local plot = chart.newChart{ type = 'bar' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Bar chart' )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )

    for i = 1, 2 do
        local set = plot:newDataSet()
        for j = 1, 6 do
            set:addDataPoint( math.sqrt( i*j ) )
        end
        set.label = 'Set ' .. i

        if i == 1 then
            set.color = chart.colorPallets.green[3]
        else
            set.color = chart.colorPallets.orange[3]
        end
    end

    local labels = {}

    for i = 1, 6 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"bar","options":{"tooltips":{"intersect":false},"scales":{"y":{"ticks":{"beginAtZero":true},"type":"category","scaleLabel":{"display":true,"labelString":"y axis label"}},"x":{"offset":false,"type":"linear","scaleLabel":{"display":true,"labelString":"x axis label"},"gridLines":{"offsetGridLines":false},"ticks":{"beginAtZero":true}}},"title":{"display":true,"font":{"size":18},"text":"HorizontalBar chart","position":"top"},"aspectRatio":1,"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"isFinished":true,"height":"10vh","minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"label":"Set 1","indexAxis":"y","borderWidth":1,"hoverBackgroundColor":"rgba(109,193,110,0.5)","backgroundColor":"rgba(120,198,121,0.4)","hoverBorderColor":"rgba(109,193,110,1)","borderColor":"rgba(120,198,121,1)","color":"rgba(120,198,121,1)","clip":5,"data":[1,1.4142135623730951,1.7320508075688772,2,2.23606797749979,2.449489742783178]},{"label":"Set 2","indexAxis":"y","borderWidth":1,"hoverBackgroundColor":"rgba(254,146,26,0.5)","backgroundColor":"rgba(254,153,41,0.4)","hoverBorderColor":"rgba(254,146,26,1)","borderColor":"rgba(254,153,41,1)","color":"rgba(254,153,41,1)","clip":5,"data":[1.4142135623730951,2,2.449489742783178,2.8284271247461903,3.1622776601683795,3.4641016151377544]}]}}
Code

{{Chart data|Chart data/doc examples|horizontalBar}}

function p.horizontalBar()
    local plot = chart.newChart{ type = 'horizontalBar' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'HorizontalBar chart' )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )

    for i = 1, 2 do
        local set = plot:newDataSet()
        for j = 1, 6 do
            set:addDataPoint( math.sqrt( i*j ) )
        end
        set.label = 'Set ' .. i

        if i == 1 then
            set.color = chart.colorPallets.green[3]
        else
            set.color = chart.colorPallets.orange[3]
        end
    end

    local labels = {}

    for i = 1, 6 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"radar","options":{"scale":{"min":0,"ticks":{"showLabelBackdrop":false,"z":1},"max":5},"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Radar chart","position":"top"},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vw","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"label":"Set 1","data":[1.1054339995714253,1.7620466300282018,1.9252051673625146,2.8252091418960124,2.67948377636813,3.0654489855507467],"hoverBorderColor":"rgba(151,198,222,1)","borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.3)","clip":5,"fill":false},{"label":"Set 2","data":[1.5964949166349123,2.392213408807727,3.0500465353746513,3.368869516504649,4.3642936109400186,4.637400496548407],"hoverBorderColor":"rgba(29,114,171,1)","borderColor":"rgba(31,120,180,1)","hoverBackgroundColor":"rgba(29,114,171,0.5)","backgroundColor":"rgba(31,120,180,0.3)","clip":5,"fill":false},{"label":"Set 3","data":[1.919159774308544,2.717299940079637,3.872820717553868,4.002878885815963,4.714183860661343,5.107611022043776],"hoverBackgroundColor":"rgba(169,219,124,0.5)","borderColor":"rgba(178,223,138,1)","backgroundColor":"rgba(178,223,138,0.3)","hoverBorderColor":"rgba(169,219,124,1)","clip":5,"fill":true},{"label":"Set 4","data":[2.7481761049604683,3.2205473092944183,3.583229637507928,5.515767517019176,6.21912330282,5.9950528373603325],"hoverBorderColor":"rgba(48,152,42,1)","borderColor":"rgba(51,160,44,1)","hoverBackgroundColor":"rgba(48,152,42,0.5)","backgroundColor":"rgba(51,160,44,0.3)","clip":5,"fill":false},{"label":"Set 5","data":[2.9424090583403157,3.961925189685549,4.827462715401098,6.1926825505408845,6.644525966739941,6.899639803830769],"hoverBorderColor":"rgba(250,135,134,1)","borderColor":"rgba(251,154,153,1)","hoverBackgroundColor":"rgba(250,135,134,0.5)","backgroundColor":"rgba(251,154,153,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|radar}}

function p.radar()
    local plot = chart.newChart{ type = 'radar' }
    plot:setDimensions( '10vw', nil, 300, nil, true ) -- Radar chart is always square. height = width
    plot:setTitle( 'Radar chart' )
    plot:setRadialLimits( 0, 5 )
    plot.fill = false

    for i = 1, 5 do
        local set = plot:newDataSet()
        for j = 1, 6 do
            set:addDataPoint( math.sqrt( i*j*(math.random()+1) ) )
        end
        set.label = 'Set ' .. i

        if i == 3 then
            set.fill = true
        end
    end

    local labels = {}

    for i = 1, 6 do
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"pie","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Pie chart","position":"top"},"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vw","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"hoverBackgroundColor":["rgba(151,198,222,0.9)","rgba(29,114,171,0.9)","rgba(169,219,124,0.9)","rgba(48,152,42,0.9)","rgba(250,135,134,0.9)","rgba(216,25,27,0.9)"],"backgroundColor":["rgba(166,206,227,0.8)","rgba(31,120,180,0.8)","rgba(178,223,138,0.8)","rgba(51,160,44,0.8)","rgba(251,154,153,0.8)","rgba(227,26,28,0.8)"],"borderColor":["rgba(166,206,227,1)","rgba(31,120,180,1)","rgba(178,223,138,1)","rgba(51,160,44,1)","rgba(251,154,153,1)","rgba(227,26,28,1)"],"hoverBorderColor":["rgba(151,198,222,1)","rgba(29,114,171,1)","rgba(169,219,124,1)","rgba(48,152,42,1)","rgba(250,135,134,1)","rgba(216,25,27,1)"],"clip":5,"data":[1,1.4,1.7,2,2.2,2.4]}]}}
Code

{{Chart data|Chart data/doc examples|pie}}

function p.pie()
    local plot = chart.newChart{ type = 'pie' }
    plot:setDimensions( '10vw', nil, 300, nil, true ) -- Pie chart is always square. height = width
    plot:setTitle( 'Pie chart' )

    local labels = {}
    local set = plot:newDataSet()

    for i = 1, 6 do
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"doughnut","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Doughnut chart","position":"top"},"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vw","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"hoverBackgroundColor":["rgba(151,198,222,0.9)","rgba(29,114,171,0.9)","rgba(169,219,124,0.9)","rgba(48,152,42,0.9)","rgba(250,135,134,0.9)","rgba(216,25,27,0.9)"],"backgroundColor":["rgba(166,206,227,0.8)","rgba(31,120,180,0.8)","rgba(178,223,138,0.8)","rgba(51,160,44,0.8)","rgba(251,154,153,0.8)","rgba(227,26,28,0.8)"],"borderColor":["rgba(166,206,227,1)","rgba(31,120,180,1)","rgba(178,223,138,1)","rgba(51,160,44,1)","rgba(251,154,153,1)","rgba(227,26,28,1)"],"hoverBorderColor":["rgba(151,198,222,1)","rgba(29,114,171,1)","rgba(169,219,124,1)","rgba(48,152,42,1)","rgba(250,135,134,1)","rgba(216,25,27,1)"],"clip":5,"data":[1,1.4,1.7,2,2.2,2.4]}]}}
Code

{{Chart data|Chart data/doc examples|doughnut}}

function p.doughnut()
    local plot = chart.newChart{ type = 'doughnut' }
    plot:setDimensions( '10vw', nil, 300, nil, true ) -- doughnut chart is always square. height = width
    plot:setTitle( 'Doughnut chart' )

    local labels = {}
    local set = plot:newDataSet()

    for i = 1, 6 do
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"polarArea","options":{"scale":{"ticks":{"showLabelBackdrop":false,"z":1}},"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"PolarArea chart","position":"top"},"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vw","isFinished":true,"minHeight":"300px","data":{"labels":["Value 1","Value 2","Value 3","Value 4","Value 5","Value 6"],"datasets":[{"hoverBackgroundColor":["rgba(151,198,222,0.6)","rgba(29,114,171,0.6)","rgba(169,219,124,0.6)","rgba(48,152,42,0.6)","rgba(250,135,134,0.6)","rgba(216,25,27,0.6)"],"backgroundColor":["rgba(166,206,227,0.5)","rgba(31,120,180,0.5)","rgba(178,223,138,0.5)","rgba(51,160,44,0.5)","rgba(251,154,153,0.5)","rgba(227,26,28,0.5)"],"borderColor":["rgba(166,206,227,1)","rgba(31,120,180,1)","rgba(178,223,138,1)","rgba(51,160,44,1)","rgba(251,154,153,1)","rgba(227,26,28,1)"],"hoverBorderColor":["rgba(151,198,222,1)","rgba(29,114,171,1)","rgba(169,219,124,1)","rgba(48,152,42,1)","rgba(250,135,134,1)","rgba(216,25,27,1)"],"clip":5,"data":[1,1.4,1.7,2,2.2,2.4]}]}}
Code

{{Chart data|Chart data/doc examples|polarArea}}

function p.polarArea()
    local plot = chart.newChart{ type = 'polarArea' }
    plot:setDimensions( '10vw', nil, 300, nil, true ) -- polarArea chart is always square. height = width
    plot:setTitle( 'PolarArea chart' )

    local labels = {}
    local set = plot:newDataSet()

    for i = 1, 6 do
        set:addDataPoint( math.floor( math.sqrt( i ) * 10 + 0.5 ) / 10 )
        table.insert( labels, 'Value ' .. i )
    end

    plot:addDataLabels( labels )

    return plot:makeMwLoadDataCompatible()
end
{"type":"bubble","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Bubble chart","position":"top"},"scales":{"y":{"scaleLabel":{"display":true,"labelString":"y axis label"}},"x":{"scaleLabel":{"display":true,"labelString":"x axis label"}}},"maintainAspectRatio":false,"fill":true},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","data":[{"y":11.048083263937423,"x":2.219843274084778,"r":8.532074682196637},{"y":8.71853323128006,"x":9.954516738632003,"r":13.49244370753525},{"y":8.613424966397428,"x":2.7439800942055785,"r":13.25695966987729},{"y":18.094117444983738,"x":4.186602274042835,"r":16.881854206734268},{"y":4.612396547855994,"x":2.277247464413404,"r":14.997900517190761}],"hoverBorderColor":"rgba(151,198,222,1)","borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.4)","clip":5,"fill":true},{"label":"Set 2","data":[{"y":9.631372629493182,"x":3.352532812092701,"r":11.739741960419222},{"y":5.929812428508798,"x":8.881179759689225,"r":6.049418293893998},{"y":18.677494655678746,"x":9.014807063627433,"r":12.46291157671386},{"y":11.393702417329747,"x":7.315542133206288,"r":13.304396268587743},{"y":15.319780258145082,"x":9.174658585886778,"r":13.802514711302946}],"hoverBorderColor":"rgba(29,114,171,1)","borderColor":"rgba(31,120,180,1)","hoverBackgroundColor":"rgba(29,114,171,0.5)","backgroundColor":"rgba(31,120,180,0.4)","clip":5,"fill":true},{"label":"Set 3","data":[{"y":14.656562337026262,"x":8.20528511805706,"r":11.876036434842291},{"y":3.3071613885961293,"x":9.497465882216332,"r":9.918058589062682},{"y":8.98751901881188,"x":8.447294327638716,"r":5.013033160945882},{"y":6.531544386656742,"x":7.747231953659669,"r":9.845782897828977},{"y":5.559363572653087,"x":4.449881270737332,"r":14.33752677838203}],"hoverBorderColor":"rgba(169,219,124,1)","borderColor":"rgba(178,223,138,1)","hoverBackgroundColor":"rgba(169,219,124,0.5)","backgroundColor":"rgba(178,223,138,0.4)","clip":5,"fill":true},{"label":"Set 4","data":[{"y":12.730377331716184,"x":1.1994582233947972,"r":6.372245744044076},{"y":5.878369820247577,"x":5.693431424765583,"r":7.076752543019481},{"y":5.287218217406058,"x":4.050987662771245,"r":5.100100396713288},{"y":13.904402020342834,"x":9.440298522561928,"r":5.766213504023018},{"y":11.438156744203603,"x":6.534048037852182,"r":5.737508873332994}],"hoverBorderColor":"rgba(48,152,42,1)","borderColor":"rgba(51,160,44,1)","hoverBackgroundColor":"rgba(48,152,42,0.5)","backgroundColor":"rgba(51,160,44,0.4)","clip":5,"fill":true},{"label":"Set 5","data":[{"y":12.199589606467443,"x":8.488617394347031,"r":16.321413645670475},{"y":6.562817556114316,"x":9.54453962833832,"r":15.370786879384324},{"y":1.2357927212658304,"x":2.213936220954143,"r":11.41158394115585},{"y":1.5438295442349415,"x":8.361116246488464,"r":11.143994036197661},{"y":10.123662105819054,"x":7.140883541265914,"r":9.060997974155935}],"hoverBorderColor":"rgba(250,135,134,1)","borderColor":"rgba(251,154,153,1)","hoverBackgroundColor":"rgba(250,135,134,0.5)","backgroundColor":"rgba(251,154,153,0.4)","clip":5,"fill":true}]}}
Code

{{Chart data|Chart data/doc examples|bubble}}

function p.bubble()
    local plot = chart.newChart{ type = 'bubble' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Bubble chart' )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )

    for i = 1, 5 do
        local set = plot:newDataSet()
        for j = 1, 5 do
            set:addDataPoint{ x = math.random() * 10, y = math.random() * 20, r = math.random() * 15 + 5 }
        end
        set.label = 'Set ' .. i
    end

    return plot:makeMwLoadDataCompatible()
end
{"type":"scatter","options":{"tooltips":{"intersect":false},"aspectRatio":1,"title":{"display":true,"font":{"size":18},"text":"Scatter chart","position":"top"},"scales":{"y":{"type":"logarithmic","scaleLabel":{"display":true,"labelString":"y axis label"}},"x":{"scaleLabel":{"display":true,"labelString":"x axis label"}}},"maintainAspectRatio":false,"fill":false},"minWidth":"300px","resizable":true,"width":"10vw","isChartObj":true,"height":"10vh","isFinished":true,"minHeight":"300px","data":{"datasets":[{"label":"Set 1","showLine":true,"data":[{"y":0,"x":0},{"y":1.9933466539753062,"x":1},{"y":3.9470917115432527,"x":2},{"y":5.823212366975177,"x":3},{"y":7.586780454497614,"x":4},{"y":9.207354924039482,"x":5},{"y":10.660195429836131,"x":6},{"y":11.9272486499423,"x":7},{"y":12.997868015207526,"x":8},{"y":13.869238154390976,"x":9},{"y":14.546487134128409,"x":10},{"y":15.04248201909795,"x":11},{"y":15.377315902755754,"x":12},{"y":15.57750685910732,"x":13},{"y":15.674940750779525,"x":14},{"y":15.705600040299336,"x":15},{"y":15.7081292828621,"x":16},{"y":15.722294489865844,"x":17},{"y":15.787397783525737,"x":18},{"y":15.940710545286406,"x":19},{"y":16.21598752346036,"x":20},{"y":16.642121137932058,"x":21},{"y":17.24198963055242,"x":22},{"y":18.031544981832678,"x":23},{"y":19.019176955820797,"x":24},{"y":20.205378626684308,"x":25},{"y":21.582726721399233,"x":26},{"y":23.136177562220062,"x":27},{"y":24.843666810638393,"x":28},{"y":26.676989102931213,"x":29},{"y":28.60292250900537,"x":30},{"y":30.584552985912516,"x":31},{"y":32.582746024252465,"x":32},{"y":34.55770681756689,"x":33},{"y":36.47056675569304,"x":34},{"y":38.28493299359395,"x":35},{"y":39.968339319245764,"x":36},{"y":41.49354047905813,"x":37},{"y":42.83959836015743,"x":38},{"y":43.99271672687303,"x":39},{"y":44.94679123311691,"x":40},{"y":45.703652783398866,"x":41},{"y":46.2729945404414,"x":42},{"y":46.67198548937057,"x":43},{"y":46.92458596445881,"x":44},{"y":47.060592426208785,"x":45},{"y":47.114449570501236,"x":46},{"y":47.12387712726679,"x":47},{"y":47.1283660938851,"x":48},{"y":47.16760435374036,"x":49},{"y":47.279894445553154,"x":50},{"y":47.50062656203229,"x":51},{"y":47.860867654571734,"x":52},{"y":48.38612289193597,"x":53},{"y":49.09531884966754,"x":54},{"y":50.000048967246485,"x":55},{"y":51.104111354243415,"x":56},{"y":52.40335737167662,"x":57},{"y":53.885857025156454,"x":58},{"y":55.532374576114385,"x":59},{"y":57.317135409997825,"x":60},{"y":59.208853588815856,"x":61},{"y":61.17197912275845,"x":62},{"y":63.168115236105685,"x":63},{"y":65.1575491255077,"x":64},{"y":67.1008351841332,"x":65},{"y":68.96036757353612,"x":66},{"y":70.70187944976225,"x":67},{"y":72.29580907428247,"x":68},{"y":73.71847834722053,"x":69},{"y":74.95303677847436,"x":70},{"y":75.99013326358181,"x":71},{"y":76.82828888274639,"x":72},{"y":77.47395586070252,"x":73},{"y":77.94126033687658,"x":74},{"y":78.25143920078558,"x":75},{"y":78.431993444269,"x":76},{"y":78.51559178372851,"x":77},{"y":78.53876826149722,"x":78},{"y":78.54046574886159,"x":79},{"y":78.56048341667467,"x":80},{"y":78.63789006800766,"x":81},{"y":78.80946658826026,"x":82},{"y":79.10823960732851,"x":83},{"y":79.56216483209248,"x":84},{"y":80.19301254060221,"x":85},{"y":81.01549966979202,"x":86},{"y":82.03670309764684,"x":87},{"y":83.25577751040937,"x":88},{"y":84.66398910257209,"x":89},{"y":86.24506376614161,"x":90},{"y":87.97583588796859,"x":91},{"y":89.82717188964051,"x":92},{"y":91.7651316913169,"x":93},{"y":93.75232179560817,"x":94},{"y":95.74938604831476,"x":95},{"y":97.71657464409948,"x":96},{"y":99.61532882578848,"x":97},{"y":101.40981810034067,"x":98},{"y":103.06836868753552,"x":99},{"y":104.56472625363814,"x":100}],"hoverBorderColor":"rgba(151,198,222,1)","borderColor":"rgba(166,206,227,1)","hoverBackgroundColor":"rgba(151,198,222,0.5)","backgroundColor":"rgba(166,206,227,0.3)","clip":5,"fill":false},{"label":"Set 2","showLine":true,"data":[{"y":0,"x":0},{"y":3.973430882914549,"x":1},{"y":15.579532979333443,"x":2},{"y":33.90980227089265,"x":3},{"y":57.55923766474702,"x":4},{"y":84.77538469723409,"x":5},{"y":113.63976660229913,"x":6},{"y":142.2592603575504,"x":7},{"y":168.94457294075485,"x":8},{"y":192.3557669832144,"x":9},{"y":211.60028794336333,"x":10},{"y":226.27626529488512,"x":11},{"y":236.461844373145,"x":12},{"y":242.6587199455356,"x":13},{"y":245.70376754044858,"x":14},{"y":246.6658726258505,"x":15},{"y":246.74532556710977,"x":16},{"y":247.19054402606588,"x":17},{"y":249.24192877527335,"x":18},{"y":254.10625268860522,"x":19},{"y":262.95825136102206,"x":20},{"y":276.960195969605,"x":21},{"y":297.28620642007724,"x":22},{"y":325.1366144318552,"x":23},{"y":361.7290920768248,"x":24},{"y":408.25732544767106,"x":25},{"y":465.81409273060046,"x":26},{"y":535.2827121905751,"x":27},{"y":617.2077805980156,"x":28},{"y":711.6617475979107,"x":29},{"y":818.127176056166,"x":30},{"y":935.4148813480903,"x":31},{"y":1061.63533848094,"x":32},{"y":1194.235100488909,"x":33},{"y":1330.1022394814624,"x":34},{"y":1465.7360943239785,"x":35},{"y":1597.4681479383669,"x":36},{"y":1721.713901487236,"x":37},{"y":1835.2311876596034,"x":38},{"y":1935.3591250108939,"x":39},{"y":2020.2140421533952,"x":40},{"y":2088.823877745483,"x":41},{"y":2141.19002373972,"x":42},{"y":2178.274229520017,"x":43},{"y":2201.9167679358843,"x":44},{"y":2214.6993595057397,"x":45},{"y":2219.7713583313043,"x":46},{"y":2220.6597955057377,"x":47},{"y":2221.0828906792585,"x":48},{"y":2224.7829004709865,"x":49},{"y":2235.388418782648,"x":50},{"y":2256.3095237856473,"x":51},{"y":2290.662652648431,"x":52},{"y":2341.21688851353,"x":53},{"y":2410.350332950521,"x":54},{"y":2500.0048967270463,"x":55},{"y":2611.6301973069108,"x":56},{"y":2746.1118638236544,"x":57},{"y":2903.685587335603,"x":58},{"y":3083.8446260618753,"x":59},{"y":3285.2540116080263,"x":60},{"y":3505.6883433018324,"x":61},{"y":3742.0110297951956,"x":62},{"y":3990.2107824819273,"x":63},{"y":4245.506208042949,"x":64},{"y":4502.522082408208,"x":65},{"y":4755.532295877211,"x":66},{"y":4998.7557577287125,"x":67},{"y":5226.6840097051045,"x":68},{"y":5434.414049829621,"x":69},{"y":5617.957722315329,"x":70},{"y":5774.500353416923,"x":71},{"y":5902.585972650733,"x":72},{"y":6002.213836706082,"x":73},{"y":6074.84006290077,"x":74},{"y":6123.287736994243,"x":75},{"y":6151.577595641855,"x":76},{"y":6164.698153149096,"x":77},{"y":6168.338120033164,"x":78},{"y":6168.604760048101,"x":79},{"y":6171.7495546616165,"x":80},{"y":6183.917754348058,"x":81},{"y":6210.932023926111,"x":82},{"y":6258.1135737705,"x":83},{"y":6330.138072769053,"x":84},{"y":6430.919260337184,"x":85},{"y":6563.511186746071,"x":86},{"y":6730.020655131458,"x":87},{"y":6931.524488862788,"x":88},{"y":7167.991050760445,"x":89},{"y":7438.211024025833,"x":90},{"y":7739.747700186781,"x":91},{"y":8068.920809691022,"x":92},{"y":8420.839394324732,"x":93},{"y":8789.497842067267,"x":94},{"y":9167.944928629213,"x":95},{"y":9548.528960175865,"x":96},{"y":9923.213737069966,"x":97},{"y":10283.951207144182,"x":98},{"y":10623.088623909753,"x":99},{"y":10933.781976498281,"x":100}],"hoverBackgroundColor":"rgba(29,114,171,0.5)","borderColor":"rgba(31,120,180,1)","backgroundColor":"rgba(31,120,180,0.3)","hoverBorderColor":"rgba(29,114,171,1)","clip":5,"fill":"+2"},{"label":"Set 3","showLine":true,"data":[{"y":0,"x":0},{"y":7.9204251552598635,"x":1},{"y":61.49384549244179,"x":2},{"y":197.463979945545,"x":3},{"y":436.6892992906856,"x":4},{"y":780.5570557294196,"x":5},{"y":1211.4221205814738,"x":6},{"y":1696.7615710413831,"x":7},{"y":2195.9192609695324,"x":8},{"y":2667.827942660737,"x":9},{"y":3078.0408661460015,"x":10},{"y":3403.756652046947,"x":11},{"y":3636.148479874119,"x":12},{"y":3780.017874373783,"x":13},{"y":3851.391998439837,"x":14},{"y":3874.0355390530285,"x":15},{"y":3875.9074739500593,"x":16},{"y":3886.4025282879556,"x":17},{"y":3934.88147390843,"x":18},{"y":4050.634221856461,"x":19},{"y":4264.1277232612865,"x":20},{"y":4609.205131711569,"x":21},{"y":5125.805688401238,"x":22},{"y":5862.715488368785,"x":23},{"y":6879.7896122775255,"x":24},{"y":8248.993837787672,"x":25},{"y":10053.53826638107,"x":26},{"y":12384.395875227883,"x":27},{"y":15333.704454110702,"x":28},{"y":18984.992685642446,"x":29},{"y":23400.828219245912,"x":30},{"y":28609.246002401735,"x":31},{"y":34590.994604095766,"x":32},{"y":41270.026473943246,"x":33},{"y":48509.582516905495,"x":34},{"y":56115.608157485614,"x":35},{"y":63848.148988487745,"x":36},{"y":71440.00546471773,"x":37},{"y":78620.56697737212,"x":38},{"y":85141.7057513731,"x":39},{"y":90802.13879887991,"x":40},{"y":95466.88123415234,"x":41},{"y":99079.27427855565,"x":42},{"y":101664.38323202809,"x":43},{"y":103324.0326635907,"x":44},{"y":104225.06390428526,"x":45},{"y":104583.30572014325,"x":46},{"y":104646.09934487379,"x":47},{"y":104676.00759679667,"x":48},{"y":104937.6796223824,"x":49},{"y":105688.92848485557,"x":50},{"y":107176.11609769895,"x":51},{"y":109633.10205967678,"x":52},{"y":113282.40808429162,"x":53},{"y":118336.91813560815,"x":54},{"y":125000.36725470831,"x":55},{"y":133465.04041927707,"x":56},{"y":143905.48138255192,"x":57},{"y":156467.58640517376,"x":58},{"y":171253.21490900547,"x":59},{"y":188301.3490395758,"x":60},{"y":207567.7878465766,"x":61},{"y":228906.22059176356,"x":62},{"y":252054.0945241698,"x":63},{"y":276626.7793132064,"x":64},{"y":302122.9921645934,"x":65},{"y":327943.2551315146,"x":66},{"y":353421.4269817404,"x":67},{"y":377867.34925724537,"x":68},{"y":400616.73446219595,"x":69},{"y":421082.9917806149,"x":70},{"y":438805.0513867522,"x":71},{"y":453485.5802620571,"x":72},{"y":465015.2498514649,"x":73},{"y":473480.69084743666,"x":74},{"y":479156.0780603209,"x":75},{"y":482480.493653294,"x":76},{"y":484024.9236625595,"x":77},{"y":484453.67816784413,"x":78},{"y":484485.09087482246,"x":79},{"y":484855.62854086317,"x":80},{"y":486290.24455602345,"x":81},{"y":489480.23982156056,"x":82},{"y":495068.34808371164,"x":83},{"y":503639.4887555556,"x":84},{"y":515714.78889182006,"x":85},{"y":531746.1383825026,"x":86},{"y":552108.7063260501,"x":87},{"y":577089.4606527142,"x":88},{"y":606870.7162089166,"x":89},{"y":641508.9840731254,"x":90},{"y":680910.7734859146,"x":91},{"y":724808.3365360127,"x":92},{"y":772739.4359716383,"x":93},{"y":824035.8301112939,"x":94},{"y":877825.0982410081,"x":95},{"y":933049.5428783706,"x":96},{"y":988504.199426806,"x":97},{"y":1042893.6212692704,"x":98},{"y":1094904.414889495,"x":99},{"y":1143287.9192895053,"x":100}],"hoverBorderColor":"rgba(169,219,124,1)","borderColor":"rgba(178,223,138,1)","hoverBackgroundColor":"rgba(169,219,124,0.5)","backgroundColor":"rgba(178,223,138,0.3)","clip":5,"fill":false},{"label":"Set 4","showLine":true,"data":[{"y":0,"x":0},{"y":15.788152981299094,"x":1},{"y":242.72184785413842,"x":2},{"y":1149.874690051036,"x":3},{"y":3313.065840546832,"x":4},{"y":7186.865850564032,"x":5},{"y":12913.996553425022,"x":6},{"y":20237.697157477312,"x":7},{"y":28542.268726134032,"x":8},{"y":37000.74109170068,"x":9},{"y":44774.68185771427,"x":10},{"y":51200.94823580123,"x":11},{"y":55914.20384434945,"x":12},{"y":58883.25436560588,"x":13},{"y":60370.34138357079,"x":14},{"y":60844.0527182723,"x":15},{"y":60883.255689219,"x":16},{"y":61103.165055902406,"x":17},{"y":62121.53905961844,"x":18},{"y":64569.987655445286,"x":19},{"y":69147.04195884646,"x":20},{"y":76706.95015152202,"x":21},{"y":88379.08852764076,"x":22},{"y":105713.81804420888,"x":23},{"y":130847.936054724,"x":24},{"y":166674.04378168558,"x":25},{"y":216982.76898643246,"x":26},{"y":286527.581970098,"x":27},{"y":380945.44443072815,"x":28},{"y":506462.4429941123,"x":29},{"y":669332.076201637,"x":30},{"y":875001.0002474617,"x":31},{"y":1127069.5919115397,"x":32},{"y":1426197.4752397547,"x":33},{"y":1769171.967473602,"x":34},{"y":2148382.2982041105,"x":35},{"y":2551904.4836776364,"x":36},{"y":2964298.758574399,"x":37},{"y":3368073.512158478,"x":38},{"y":3745614.9427629327,"x":39},{"y":4081264.77611376,"x":40},{"y":4363185.192239676,"x":41},{"y":4584694.717762502,"x":42},{"y":4744878.618991024,"x":43},{"y":4848437.452917212,"x":44},{"y":4904893.252995133,"x":45},{"y":4927384.883268003,"x":46},{"y":4931329.927375586,"x":47},{"y":4933209.207268131,"x":48},{"y":4949658.954228095,"x":49},{"y":4996961.382827587,"x":50},{"y":5090932.667125815,"x":51},{"y":5247135.388238346,"x":52},{"y":5481296.519060975,"x":53},{"y":5809788.727554688,"x":54},{"y":6250024.48365921,"x":55},{"y":6820612.287485333,"x":56},{"y":7541130.368633024,"x":57},{"y":8431389.990100507,"x":58},{"y":9510097.677690707,"x":59},{"y":10792893.92078663,"x":60},{"y":12289850.760362346,"x":61},{"y":14002646.547108902,"x":62},{"y":15921782.088635033,"x":63},{"y":18024322.96253122,"x":64},{"y":20272705.102573548,"x":65},{"y":22615087.417131186,"x":66},{"y":24987559.125425957,"x":67},{"y":27318225.737307023,"x":68},{"y":29532856.06498559,"x":69},{"y":31561448.969722446,"x":70},{"y":33344854.331612166,"x":71},{"y":34840521.1645332,"x":72},{"y":36026570.94154594,"x":73},{"y":36903681.78982424,"x":74},{"y":37494652.71002407,"x":75},{"y":37841906.915202826,"x":76},{"y":38003503.31943987,"x":77},{"y":38048395.163054265,"x":78},{"y":38051684.685688086,"x":79},{"y":38090492.56546585,"x":80},{"y":38240838.79254113,"x":81},{"y":38575676.60583089,"x":82},{"y":39163985.50221058,"x":83},{"y":40070648.020320304,"x":84},{"y":41356722.53297575,"x":85},{"y":43079679.09854082,"x":86},{"y":45293178.01849606,"x":87},{"y":48046031.73970453,"x":88},{"y":51380095.703781836,"x":89},{"y":55326983.23793943,"x":90},{"y":59903694.46254657,"x":91},{"y":65107483.03306482,"x":92},{"y":70910536.10501133,"x":93},{"y":77255272.31570514,"x":94},{"y":84051214.21437812,"x":95},{"y":91174405.3033172,"x":96},{"y":98470170.87157407,"x":97},{"y":105759652.43092228,"x":98},{"y":112850011.91144082,"x":99},{"y":119547588.30959867,"x":100}],"hoverBorderColor":"rgba(48,152,42,1)","borderColor":"rgba(51,160,44,1)","hoverBackgroundColor":"rgba(48,152,42,0.5)","backgroundColor":"rgba(51,160,44,0.3)","clip":5,"fill":false},{"label":"Set 5","showLine":true,"data":[{"y":0,"x":0},{"y":31.471261917722803,"x":1},{"y":958.0453938755321,"x":2},{"y":6695.964515576942,"x":3},{"y":25135.503163524412,"x":4},{"y":66172.02467760195,"x":5},{"y":137665.72703974097,"x":6},{"y":241380.0460994624,"x":7},{"y":370988.6417568756,"x":8},{"y":513172.090089757,"x":9},{"y":651314.3335779334,"x":10},{"y":770189.343197805,"x":11},{"y":859810.3759656417,"x":12},{"y":917254.2987667866,"x":13},{"y":946301.5242918055,"x":14},{"y":955592.3568240724,"x":15},{"y":956362.0515278014,"x":16},{"y":960681.9552717776,"x":17},{"y":980737.4480590275,"x":18},{"y":1029291.4831281697,"x":19},{"y":1121287.569688844,"x":20},{"y":1276566.3565429454,"x":21},{"y":1523831.3279512564,"x":22},{"y":1906183.4652654275,"x":23},{"y":2488620.0501287202,"x":24},{"y":3367712.1618495146,"x":25},{"y":4683079.806286673,"x":26},{"y":6629153.012933752,"x":27},{"y":9464081.694467574,"x":28},{"y":13510893.072797855,"x":29},{"y":19144853.5083871,"x":30},{"y":26761514.454794943,"x":31},{"y":36723022.26491157,"x":32},{"y":49286114.21328955,"x":33},{"y":64522704.3420468,"x":34},{"y":82250672.33136775,"x":35},{"y":101995384.31393243,"x":36},{"y":122999250.53092861,"x":37},{"y":144286916.508354,"x":38},{"y":164779777.14491242,"x":39},{"y":183439755.85905883,"x":40},{"y":199413501.0557896,"x":41},{"y":212147553.6446148,"x":42},{"y":221452906.05437374,"x":43},{"y":227510920.0527154,"x":44},{"y":230827182.27326536,"x":45},{"y":232151026.59718046,"x":46},{"y":232383385.57166055,"x":47},{"y":232494089.53785717,"x":48},{"y":233463555.23897904,"x":49},{"y":236255806.72859365,"x":50},{"y":241822491.47359434,"x":51},{"y":251132452.38209534,"x":52},{"y":265218686.97842517,"x":53},{"y":285233430.0285017,"x":54},{"y":312501530.2294499,"x":55},{"y":348561329.8437714,"x":56},{"y":395180549.69387984,"x":57},{"y":454332675.5298912,"x":58},{"y":528118306.4929559,"x":59},{"y":618617762.3234696,"x":60},{"y":727667974.2986914,"x":61},{"y":856569602.2431115,"x":62},{"y":1005748965.7390612,"x":63},{"y":1174420708.8851445,"x":64},{"y":1360315443.824324,"x":65},{"y":1559544740.993018,"x":66},{"y":1766667393.0296726,"x":67},{"y":1974993232.1524982,"x":68},{"y":2177117210.3582206,"x":69},{"y":2365626445.409548,"x":70},{"y":2533879924.3139315,"x":71},{"y":2676737624.854196,"x":72},{"y":2791120966.9377985,"x":73},{"y":2876319469.7699423,"x":74},{"y":2934010536.893019,"x":75},{"y":2968016195.0918255,"x":76},{"y":2983867552.9807124,"x":77},{"y":2988274090.432991,"x":78},{"y":2988597037.7427664,"x":79},{"y":2992407509.52225,"x":80},{"y":3007178877.0762525,"x":81},{"y":3040128496.586763,"x":82},{"y":3098193949.0868144,"x":83},{"y":3188107502.7214837,"x":84},{"y":3316520168.72513,"x":85},{"y":3490121727.78258,"x":86},{"y":3715702997.452225,"x":87},{"y":4000109728.778907,"x":88},{"y":4350043862.754096,"x":89},{"y":4771679197.344335,"x":90},{"y":5270077593.120009,"x":91},{"y":5848421069.712967,"x":92},{"y":6507114683.978246,"x":93},{"y":7242861150.549327,"x":94},{"y":8047852157.642091,"x":95},{"y":8909250581.452974,"x":96},{"y":9809138450.903429,"x":97},{"y":10725067115.375082,"x":98},{"y":11631266634.081158,"x":99},{"y":12500460845.875816,"x":100}],"hoverBorderColor":"rgba(250,135,134,1)","borderColor":"rgba(251,154,153,1)","hoverBackgroundColor":"rgba(250,135,134,0.5)","backgroundColor":"rgba(251,154,153,0.3)","clip":5,"fill":false}]}}
Code

{{Chart data|Chart data/doc examples|scatter}}

function p.scatter()
    local plot = chart.newChart{ type = 'scatter' }
    plot:setDimensions( '10vw', '10vh', 300, 300, true )
    plot:setTitle( 'Scatter chart' )
    plot:setXLabel( 'x axis label' )
    plot:setYLabel( 'y axis label' )
    plot:setYAxisType( 'logarithmic' )
    plot.fill = false

    for i = 1, 5 do
        local set = plot:newDataSet()
        set.data = chart.generateXYFromFunc( function(x) return (math.sin( x/5 ) * 5 + x)^i end, 0, 100 )
        set.label = 'Set ' .. i

        if i == 2 then
            set.fill = '+2'
        end
    end

    return plot:makeMwLoadDataCompatible()
end

-- <nowiki>
---@class chart
local chart = {}

---@class dataSet
local dataSet = {}

local libraryUtil = require( 'Module:libraryUtil' )
local rgba = require( 'Module:Rgba' )
local isEmpty = require( 'Module:Paramtest' ).is_empty
local arr = require( 'Module:Array' )

---@alias xyData table<string, number>
---@alias xyDataSet xyData[]
---@alias dataArr number[]
---@alias options_t table<string, string|number|options_t>

---@param val any
---@param default any
---@return any
local function default( val, default )
    if val == nil or (type( val ) == 'string' and isEmpty( val )) then
        return default
    else
        return val
    end
end

---@param obj chart | dataSet
---@param options options_t
local function defaultOptions( obj, options )
     local function _setOptions( tbl, options )
        for k, v in pairs( options ) do
            if type( v ) == 'table' and type( tbl[k] ) == 'table' then
                _setOptions( tbl[k], v )
            else
                tbl[k] = default( tbl[k], v )
            end
        end
    end

    _setOptions( obj, options )
end

local function stripNonChartJsVariables( tbl )
    local stripVarNames = {
        colorPallet = true,
        backgroundAlpha = true,
        hoverLightenValue = true,
        hoverSaturateValue = true,
        hoverAlpha = true,
        widthVal = true,
        heightVal = true,
        flippedXY = true
    }

    local function _strip( tbl )
        for k, v in pairs( tbl ) do
            if stripVarNames[k] then
                tbl[k] = nil
            elseif type( v ) == 'table' then
                _strip( v )
            end
        end
    end

    _strip( tbl )
end

---@param tbl table
---@param seen table | nil @Only for internal use
local function stripInvalidValues( tbl, seen )
    seen = seen or {}
    seen[tbl] = true

    for k, v in pairs( tbl ) do
        if type( k ) == 'table' or type( k ) == 'function' then
            tbl[k] = nil
        elseif type( v ) == 'function' then
            tbl[k] = nil
        elseif seen[v] then
            tbl[k] = nil
        elseif type( v ) == 'table' then
            local mt = getmetatable( v )
            if mt and mt.__tostring then
                tbl[k] = tostring( v )
            else
                stripInvalidValues( v, seen )
            end
        end
    end

    setmetatable( tbl, nil )
    stripNonChartJsVariables( tbl )
end

-- =====================
--      Chart class
-- =====================
local checkChartClass = libraryUtil.makeCheckClassFunction( 'Module:Chart data' , 'chart', chart, 'chart object' )
chart.rgba = rgba
chart.colorPallets = {
    qualitative = {
        name = 'qualitative',
        rgba.new( 166,206,227 ),
        rgba.new( 31,120,180 ),
        rgba.new( 178,223,138 ),
        rgba.new( 51,160,44 ),
        rgba.new( 251,154,153 ),
        rgba.new( 227,26,28 ),
        rgba.new( 253,191,111 ),
        rgba.new( 255,127,0 ),
        rgba.new( 202,178,214 ),
        rgba.new( 106,61,154 )
    },
    blue = {
        name = 'blue',
        rgba.new( 208,209,230 ),
        rgba.new( 166,189,219 ),
        rgba.new( 103,169,207 ),
        rgba.new( 54,144,192 ),
        rgba.new( 2,129,138 ),
        rgba.new( 1,108,89 ),
        rgba.new( 1,70,54 )
    },
    green = {
        name = 'green',
        rgba.new( 217,240,163 ),
        rgba.new( 173,221,142 ),
        rgba.new( 120,198,121 ),
        rgba.new( 65,171,93 ),
        rgba.new( 35,132,67 ),
        rgba.new( 0,104,55 ),
        rgba.new( 0,69,41 )
    },
    blueGreen = {
        name = 'blueGreen',
        rgba.new( 204,236,230 ),
        rgba.new( 153,216,201 ),
        rgba.new( 102,194,164 ),
        rgba.new( 65,174,118 ),
        rgba.new( 35,139,69 ),
        rgba.new( 0,109,44 ),
        rgba.new( 0,68,27 )
    },
    orange = {
        name = 'orange',
        rgba.new( 254,227,145 ),
        rgba.new( 254,196,79 ),
        rgba.new( 254,153,41 ),
        rgba.new( 236,112,20 ),
        rgba.new( 204,76,2 ),
        rgba.new( 153,52,4 ),
        rgba.new( 102,37,6 )
    }
}

local colorPalletMt = {
    __index = function ( self, i )  -- Use the next color pallet if one pallet is too small for all the lines
        local pallet = next( chart.colorPallets, self.name ) or next( chart.colorPallets )
        pallet = chart.colorPallets[ pallet ]
        return pallet[ i - #self ]
    end,
    __tostring = function ( t ) return t.name end
}

for _, set in pairs( chart.colorPallets ) do
    if type( set ) == 'table' then
        setmetatable( set, colorPalletMt )
    end
end

function chart.main( frame )
    return chart._main( (frame:getParent() or frame).args )
end

---@param args options_t
---@return string
function chart._main( args )
    libraryUtil.checkType( 'Module:Chart_data._main', 1, args, 'table' )

    local data = args

    if not data.isChartObj then
        local moduleName = args.dataModule or args[1]
        local funcName = args['function'] or args[2]

        if isEmpty( moduleName ) then
            error( 'Data module was not provided or is empty' )
        end

        if moduleName:find( '[Mm]odule:' ) == nil then
            moduleName = 'Module:' .. moduleName
        end

        if funcName then
            data = require( moduleName )[ funcName ]( args )

            assert( type( data )=='table', string.format(
                "Error: function '%s' from module '%s' returned an invalid type (table expected, got %s)",
                funcName, moduleName, type( data ) ) )

            if data.isChartObj and not data.isFinished then
                data:finish()
            end
        else
            data = mw.loadData( moduleName )
        end
    end

    local width = args.width or data.width or '60vw'
    local height = args.height or data.height or '60vh'
    local minWidth = args.minWidth or args.min_width or data.minWidth or '400px'
    local minHeight = args.minHeight or args.min_height or data.minHeight or '400px'

    return string.format(
        '<div class="rsw-chartjs rsw-chartjs-config" style="position:relative; margin:1em 0; width:%s; height:%s; min-width:%s; min-height:%s;%s"><pre>%s</pre></div>',
        width,
        height,
        minWidth,
        minHeight,
        data.resizable and ' resize:both; overflow:hidden; padding:0 5px 5px 0;' or '',
        mw.text.jsonEncode( data )
    )
end

---@param ys number[]
---@param xs number[] | nil
---@return xyDataSet
function chart.convertToXYFormat( ys, xs )
    libraryUtil.checkType( 'Module:Chart_data.convertToXYFormat', 1, ys, 'table' )
    libraryUtil.checkType( 'Module:Chart_data.convertToXYFormat', 2, xs, 'table', true )

    xs = xs or {}
    local ret = {}

    for i,v in ipairs( ys ) do
        table.insert( ret, { x=(xs[i] or i), y=v } )
    end

    return ret
end

---@param func function
---@param start_x number
---@param end_x number
---@param step number
---@return xyDataSet
function chart.generateXYFromFunc( func, start_x, end_x, step )
    libraryUtil.checkType( 'Module:Chart_data.generateXYFromFunc', 1, func, 'function' )
    libraryUtil.checkType( 'Module:Chart_data.generateXYFromFunc', 2, start_x, 'number' )
    libraryUtil.checkType( 'Module:Chart_data.generateXYFromFunc', 3, end_x, 'number' )
    libraryUtil.checkType( 'Module:Chart_data.generateXYFromFunc', 4, step, 'number',  true )

    step = step or 1
    local ret = {}

    for i = start_x, end_x, step do
        table.insert( ret, { x=i, y=func( i ) } )
    end

    return ret
end

---@param low_chance number
---@param high_chance number
---@param start_level number
---@param end_level number
---@return xyDataSet
function chart.jagexInterpolation( low_chance, high_chance, start_level, end_level )
    libraryUtil.checkType( 'Module:Chart_data.jagexInterpolation', 1, low_chance, 'number' )
    libraryUtil.checkType( 'Module:Chart_data.jagexInterpolation', 2, high_chance, 'number' )
    libraryUtil.checkType( 'Module:Chart_data.jagexInterpolation', 3, start_level, 'number' )
    libraryUtil.checkType( 'Module:Chart_data.jagexInterpolation', 4, end_level, 'number' )

    local function interpolate( x )
        return math.floor( ( (99-x)*low_chance + (x-1)*high_chance ) / 98 )
    end

    return chart.generateXYFromFunc( interpolate, start_level, end_level )
end

---@param setup options_t
---@return chart
function chart.newChart( setup )
    libraryUtil.checkType( 'Module:Chart_data.newChart', 1, setup, 'table', true )
    local obj = setup or {}

    if obj.type == 'bar' then
        defaultOptions( obj, {
            options = {
                fill = true,
                backgroundAlpha = 0.4,
                hoverLightenValue = 0.95,
                hoverAlpha = 0.5,
                hoverSaturateValue = 1,
                scales = {
                    x = { -- This is used for horizontal bar graphs
                        ticks = {
                            beginAtZero = true
                        }
                    },
                    y = {
                        ticks = {
                            beginAtZero = true
                        }
                    }
                }
            }
        } )
    elseif obj.type == 'bubble' then
        defaultOptions( obj, {
            options = {
                fill = true,
                backgroundAlpha = 0.4,
                hoverLightenValue = 0.95,
                hoverAlpha = 0.5,
                hoverSaturateValue = 1
            }
        } )
    elseif obj.type == 'radar' then
        defaultOptions( obj, {
            options = {
                scale = {
                    ticks = {
                        showLabelBackdrop = false,
                        z = 1
                    }
                }
            }
        } )
    elseif obj.type == 'pie' or obj.type == 'doughnut' then
        defaultOptions( obj, {
            options = {
                fill = true,
                backgroundAlpha = 0.8,
                hoverLightenValue = 0.95,
                hoverAlpha = 0.9,
                hoverSaturateValue = 1
            }
        } )
    elseif obj.type == 'polarArea' then
        defaultOptions( obj, {
            options = {
                fill = true,
                backgroundAlpha = 0.5,
                hoverLightenValue = 0.95,
                hoverAlpha = 0.6,
                hoverSaturateValue = 1,
                scale = {
                    ticks = {
                        showLabelBackdrop = false,
                        z = 1
                    }
                }
            }
        } )
    end

    defaultOptions( obj, {
        isChartObj = true,
        type = 'scatter',
        widthVal = '60vw',
        heightVal = '60vh',
        minWidth = 400,
        resizable = true,
        data = {
            datasets = {}
        },
        options = {
            fill = false,
            colorPallet = chart.colorPallets.qualitative,
            backgroundAlpha = 0.3,
            hoverLightenValue = 0.95,
            hoverAlpha = 0.5,
            hoverSaturateValue = 1,
            maintainAspectRatio = false,
            title = {
                font = {
                    size = 18
                }
            },
            tooltips = {
                intersect = false
            }
        }
    } )

    setmetatable( obj, chart )

    obj:setDimensions( obj.widthVal, obj.heightVal, obj.minWidth, obj.minHeight, obj.resizable )

    return obj
end

---@vararg xyDataSet | dataArr
---@return chart
function chart:addDataSets( ... )
    checkChartClass( self, 'addDataSets' )
    local sets = { ... }

    for i, set in ipairs( sets ) do
        libraryUtil.checkType( 'chart.addDataSets', i, set, 'table' )

        if not arr.contains( self.data.datasets, set, false ) then
            table.insert( self.data.datasets, set )
        end
    end

    return self
end

---@param labels string
---@return chart
function chart:addDataLabels( labels )
    checkChartClass( self, 'addDataLabels' )
    libraryUtil.checkType( 'Module:Chart_data.addDataLabels', 1, labels, 'table' )

    self.data.labels = default( self.data.labels, {} )

    for _, label in ipairs( labels ) do
        table.insert( self.data.labels, label )
    end

    return self
end

---@param width number | string
---@param height number | string | nil
---@param minWidth number | string | nil
---@param minHeight number | string | nil
---@param resizable boolean | nil
---@return chart
function chart:setDimensions( width, height, minWidth, minHeight, resizable )
    checkChartClass( self, 'setDimensions' )
    libraryUtil.checkTypeMulti( 'chart.setDimensions', 1, width, {'number', 'string'} )
    libraryUtil.checkTypeMulti( 'chart.setDimensions', 2, height, {'number', 'string', 'nil'} )
    libraryUtil.checkTypeMulti( 'chart.setDimensions', 3, minWidth, {'number', 'string', 'nil'} )
    libraryUtil.checkTypeMulti( 'chart.setDimensions', 4, minHeight, {'number', 'string', 'nil'} )
    libraryUtil.checkType( 'chart.setDimensions', 5, resizable, 'boolean', true )

    if type( width ) == 'number' then
        self.widthVal = width
        self.width = width .. 'px'
    elseif type( width ) == 'string' then
        self.width = width
        self.widthVal = tonumber( width:match( '%d+' ) )

        if type( self.widthVal ) ~= 'number' then
            error( "bad argument #1 to 'chart.setDimensions' (input doesn't contain a number)", 2 )
        end
    else
        self.widthVal = nil
        self.width = ''
    end

    if type( height ) == 'number' then
        self.heightVal = height
        self.height = height .. 'px'
    elseif type( height ) == 'string' then
        self.height = height
        self.heightVal = tonumber( height:match( '%d+' ) )

        if type( self.heightVal ) ~= 'number' then
            error( "bad argument #2 to 'chart.setDimensions' (input doesn't contain a number)", 2 )
        end
    else
        self.heightVal = nil
        self.height = ''
    end

    if type( minWidth ) == 'number' then
        self.minWidth = minWidth .. 'px'
    elseif type( minWidth ) == 'string' then
        self.minWidth = minWidth
    else
        self.minWidth = nil
    end

    if type( minHeight ) == 'number' then
        self.minHeight = minHeight .. 'px'
    elseif type( minHeight ) == 'string' then
        self.minHeight = minHeight
    else
        self.minHeight = nil
    end

    self.resizable = default( resizable, self.resizable )

    if arr.contains( {'pie', 'doughnut', 'radar', 'polarArea'}, self.type ) then
        self.height = self.width
        self.minHeight = self.minWidth
        self.options.aspectRatio = 1
    else
        if self.widthVal and self.heightVal then
            self.options.aspectRatio = self.widthVal / self.heightVal
        elseif self.widthVal then
            self.height = self.width
            self.options.aspectRatio = 1
        else
            self.options.aspectRatio = 1
        end
    end

    return self
end

---@param text string | table | nil
---@param position string | nil
---@return chart
function chart:setTitle( text, position )
    checkChartClass( self, 'setTitle' )
    libraryUtil.checkTypeMulti( 'chart.setTitle', 1, text, {'string', 'table', 'nil'} )
    libraryUtil.checkType( 'chart.setTitle', 1, position, 'string', true )

    self:setOptions{
        title = {
            display = text and true or false,
            text = text,
            position = position or 'top'
        }
    }

    return self
end

---@param label string | nil
---@return chart
function chart:setXLabel( label )
    checkChartClass( self, 'setXLabel' )
    libraryUtil.checkType( 'chart.setXLabel', 1, label, 'string', true )

    if arr.contains( {'line', 'bar', 'bubble', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                x = {
                    scaleLabel = {
                        display = label and true or false,
                        labelString = label
                    }
                }
            }
        }
    end

    return self
end

---@param label string | nil
---@return chart
function chart:setYLabel( label )
    checkChartClass( self, 'setYLabel' )
    libraryUtil.checkType( 'chart.setYLabel', 1, label, 'string', true )

    if arr.contains( {'line', 'bar', 'bubble', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                y = {
                    scaleLabel = {
                        display = label and true or false,
                        labelString = label
                    }
                }
            }
        }
    end

    return self
end

---@param min number | nil
---@param max number | nil
---@param step number | nil
---@return chart
function chart:setXLimits( min, max, step )
    checkChartClass( self, 'setXLimits' )
    libraryUtil.checkType( 'chart.setXLimits', 1, min, 'number', true )
    libraryUtil.checkType( 'chart.setXLimits', 2, max, 'number', true )
    libraryUtil.checkType( 'chart.setXLimits', 3, step, 'number', true )

    if arr.contains( {'bubble', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                x = {
                    min  = min,
                    max = max,
                    ticks = {
                        stepSize = step
                    }
                }
            }
        }
    end

    return self
end

---@param min number | nil
---@param max number | nil
---@param step number | nil
---@return chart
function chart:setYLimits( min, max, step )
    checkChartClass( self, 'setYLimits' )
    libraryUtil.checkType( 'chart.setYLimits', 1, min, 'number', true )
    libraryUtil.checkType( 'chart.setYLimits', 2, max, 'number', true )
    libraryUtil.checkType( 'chart.setYLimits', 3, step, 'number', true )

    if arr.contains( {'line', 'bar', 'bubble', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                y = {
                    min  = min,
                    max = max,
                    ticks = {
                        stepSize = step
                    }
                }
            }
        }
    end

    return self
end

---@param format string
---@return chart
function chart:setYFormat( format )
    checkChartClass( self, 'setYFormat' )
    libraryUtil.checkType( 'chart.setYFormat', 1, format, 'string', true )

    self:setOptions{
        scales = {
            y = {
                ticks = {
                    format = format
                }
            }
        }
    }

    return self
end

---@param min number | nil
---@param max number | nil
---@param step number | nil
---@return chart
function chart:setRadialLimits( min, max, step )
    checkChartClass( self, 'setRadialLimits' )
    libraryUtil.checkType( 'chart.setRadialLimits', 1, min, 'number', true )
    libraryUtil.checkType( 'chart.setRadialLimits', 2, max, 'number', true )
    libraryUtil.checkType( 'chart.setRadialLimits', 3, step, 'number', true )

    if arr.contains( {'radar', 'polarArea'}, self.type ) then
        self:setOptions{
            scale = {
                min  = min,
                max = max,
                ticks = {
                    stepSize = step
                }
            }
        }
    end

    return self
end

---@param type string | nil
---@return chart
function chart:setXAxisType( type )
    checkChartClass( self, 'setXAxisType' )
    libraryUtil.checkType( 'chart.setXAxisType', 1, type, 'string', true )

    if arr.contains( {'bar', 'bubble', 'line', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                x = {
                    type = type
                }
            }
        }
    end

    return self
end

---@param type string | nil
---@return chart
function chart:setYAxisType( type )
    checkChartClass( self, 'setYAxisType' )
    libraryUtil.checkType( 'chart.setYAxisType', 1, type, 'string', true )

    if arr.contains( {'bar', 'bubble', 'line', 'scatter'}, self.type ) then
        self:setOptions{
            scales = {
                y = {
                    type = type
                }
            }
        }
    end

    return self
end

---@param val boolean
---@return chart
function chart:showLegend( val )
    checkChartClass( self, 'showLegend' )
    libraryUtil.checkType( 'chart.showLegend', 1, val, 'boolean' )

    self:setOptions{
        legend = {
            display = val
        }
    }

    return self
end

---@param format string
---@return chart
function chart:setTooltipFormat( format )
    checkChartClass( self, 'setTooltipFormat' )
    libraryUtil.checkType( 'chart.setTooltipFormat', 1, format, 'string', true )

    self:setOptions{
        tooltips = {
        	format = format
        }
    }

    return self
end

---@param count number
---@return chart
function chart:setDatasetsPerGroup( count )
    checkChartClass( self, 'setDatasetsPerGroup' )
    libraryUtil.checkType( 'chart.setDatasetsPerGroup', 1, label, 'number', true )

    self:setOptions{
        datasetsPerGroup = count
    }

    return self
end

---@return chart
function chart:flipXY()
    checkChartClass( self, 'flipXY' )

    if self.type == 'bar' then
        self:setXAxisType( 'linear' )
            :setYAxisType( 'category' )
            :setOptions{
                scales = {
                    x = {
                        offset = false,
                        gridLines = {
                            offsetGridLines = false
                        }
                    }
                }
            }

        self.flippedXY = true

        for _, v in ipairs( self.data.datasets ) do
            v.indexAxis = 'y'
        end
    end

    return self
end

---@param options options_t
---@return chart
function chart:setOptions( options )
    checkChartClass( self, 'setOptions' )
    libraryUtil.checkType( 'chart.setOptions', 1, options, 'table' )

    local function _setOptions( tbl, options )
        for k, v in pairs( options ) do
            if type( v ) == 'table' and type( tbl[k] ) == 'table' then
                _setOptions( tbl[k], v )
            else
                tbl[k] = v
            end
        end
    end

    _setOptions( self.options, options )

    return self
end

---@return string | table
function chart:finish()
    checkChartClass( self, 'finish' )

    for i, set in ipairs( self.data.datasets ) do
        if (self.options.colorPallet or set.colorPallet) and
            self.options.backgroundAlpha and
            self.options.hoverLightenValue and
            self.options.hoverSaturateValue and
            self.options.hoverAlpha
        then
            if arr.contains( {'bar', 'pie', 'doughnut', 'polarArea'}, self.type ) then
                if set.color and not set.colorPallet then
                    set.borderColor = tostring( set.color )
                    set.hoverBorderColor = tostring( set.color:lighten( self.options.hoverLightenValue )
                                                              :saturate( self.options.hoverSaturateValue ) )

                    set.backgroundColor = tostring( set.color:fade( self.options.backgroundAlpha ) )
                    set.hoverBackgroundColor = tostring( set.color:lighten( self.options.hoverLightenValue )
                                                                  :saturate( self.options.hoverSaturateValue )
                                                                  :fade( self.options.hoverAlpha ) )
                else
                    set.borderColor = {}
                    set.hoverBorderColor = {}
                    set.backgroundColor = {}
                    set.hoverBackgroundColor = {}

                    local pallet = default( set.colorPallet, self.options.colorPallet )

                    for j = 1, #set.data do
                        table.insert( set.borderColor, tostring( pallet[j] ) )
                        table.insert( set.hoverBorderColor,
                                      tostring( pallet[j]:lighten( self.options.hoverLightenValue )
                                                         :saturate( self.options.hoverSaturateValue ) ) )

                        table.insert( set.backgroundColor, tostring( pallet[j]:fade( self.options.backgroundAlpha ) ) )
                        table.insert( set.hoverBackgroundColor,
                                      tostring( pallet[j]:lighten( self.options.hoverLightenValue )
                                                         :saturate( self.options.hoverSaturateValue )
                                                         :fade( self.options.hoverAlpha ) ) )
                    end
                end
            else
                local pallet = default( set.colorPallet, self.options.colorPallet )
                set.borderColor = default( set.borderColor, pallet[i] )

                if not set.hoverBorderColor then
                    set.hoverBorderColor = set.borderColor:lighten( self.options.hoverLightenValue )
                                                          :saturate( self.options.hoverSaturateValue )
                end

                set.backgroundColor =
                    default( set.backgroundColor, self.options.colorPallet[i]:fade( self.options.backgroundAlpha ) )

                if not set.hoverBackgroundColor then
                    set.hoverBackgroundColor = set.backgroundColor:lighten( self.options.hoverLightenValue )
                                                                  :saturate( self.options.hoverSaturateValue )
                                                                  :fade( self.options.hoverAlpha )
                end

                set.fill = default( default( set.fill, self.options.fill ), false )
            end
        end
    end

    stripInvalidValues( self )
    self.isFinished =  true

    return self
end

---@return string
function chart:tostring()
    checkChartClass( self, 'tostring' )
    self:finish()
    return chart._main( self )
end

function chart:debug()
    checkChartClass( self, 'debug' )
    local temp = colorPalletMt.__index  -- By design this makes the color pallet tables behave like they are infinitely long,
                                        -- so we have to turn this off first
    local temp2 = chart.__tostring  -- Prevent chart from being turned into a json
    colorPalletMt.__index = nil
    chart.__tostring = nil
    mw.logObject( self )
    colorPalletMt.__index = temp
    chart.__tostring = temp2
end

chart.__index = chart
chart.__tostring = chart.tostring
chart.__concat = function( x, y )
    return tostring( x ) .. tostring( y )
end

-- =======================
--      DataSet class
-- =======================
local checkDataSetClass = libraryUtil.makeCheckClassFunction( 'Module:Chart data' , 'dataSet', dataSet, 'dataSet object' )

---@param setup options_t
---@return dataSet
function chart:newDataSet( setup )
    checkChartClass( self, 'newDataSet' )
    libraryUtil.checkType( 'chart.newDataSet', 1, setup, 'table', true )
    local obj = setup or {}

    if self.type == 'scatter'  then
        obj.showLine = default( obj.showLine, true )
    end

    if self.type == 'bar' then
        obj.borderWidth = default( obj.borderWidth, 1 )

        if self.flippedXY then
            obj.indexAxis = 'y'
        end
    end

    obj.data = default( obj.data, {} )
    obj.clip = 5
    obj.parent = self

    self:addDataSets( obj )

    return setmetatable( obj, dataSet )
end

---@param data xyDataSet | dataArr
---@return dataSet
function dataSet:addData( data )
    checkDataSetClass( self, 'addData' )
    libraryUtil.checkType( 'dataSet.addData', 1, data, 'table' )

    for _, v in ipairs( data ) do
        table.insert( self.data, v )
    end

    return self
end

---@param data xyData | number
---@return dataSet
function dataSet:addDataPoint( data )
    checkDataSetClass( self, 'addDataPoint' )
    libraryUtil.checkTypeMulti( 'dataSet.addDataPoint', 1, data, {'table', 'number'} )
    table.insert( self.data, data )

    return self
end

---@param options options_t
---@return dataSet
function dataSet:setOptions( options )
    checkDataSetClass( self, 'setOptions' )
    libraryUtil.checkType( 'dataSet.setOptions', 1, options, 'table' )

    local function _setOptions( tbl, options )
        for k, v in pairs( options ) do
            if type( v ) == 'table' and type( tbl[k] ) == 'table' then
                _setOptions( tbl[k], v )
            else
                tbl[k] = v
            end
        end
    end

    _setOptions( self, options )

    return self
end

---@return chart
function dataSet:done()
    checkDataSetClass( self, 'done' )
    return self.parent
end

dataSet.__index = dataSet

return chart
-- </nowiki>