Module talk:Chart: Difference between revisions

Content deleted Content added
Line 437:
::::<code>example = function (x) ... end</code>
:::That is part of <code>example</code> being a [[first-class function]]. The above defines <code>example</code> as a global variable regardless of where the statement occurs. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 06:43, 15 May 2021 (UTC)
 
== Could this module be fed data from a table instead of as explicit parameters? ==
 
That would be real game changer for Wikipedia, as charts would be automatically updated when tables received new data. [[Module:User script table row/data|Here]] is a good example of how to read data from tables. The module could be called with a ''page name'' (if not its own), a ''table id'' (if not the 1st one), and the columns for ''labels'' and ''values'' (if not the 1st and 2nd, respectively). It would certainly break if the table is oddly shaped or malformed, but that could be minimised ignoring header rows. This shouldn't be too hard, as this module already converts parameter values into values on tables. [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 01:36, 20 May 2021 (UTC)