Content deleted Content added
→Could this module be fed data from a wikitable instead of as explicit parameters?: reworked previous (removed) response |
|||
Line 445:
::No doubt Wikidata and Commons:Data are the future, but as of now, I don't see data there being updated, do you? Look at [[commons:Data:Bea.gov/GDP by state.tab]], the very first source there on [[Template:Graph:Stacked]]: the data is 5 years stale, whereas the data at the [[List of states and territories of the United States by GDP]] is freshly updated.
::No doubt too that this is a much more fragile solution, yet much more flexible (as is typically the case with... everything in life?). Besides, not every wikitable warrants a database in Wikidata or Commons:Data, yet readers may benefit from seeing its data graphed in the article. [[User:Guarapiranga|— 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚]] ([[User talk:Guarapiranga|talk]]) 08:09, 20 May 2021 (UTC)
:::i do not think it's a good idea to overload this module with data parsing or harvesting. however, it may be a good idea to export functions to be used by other modules. tbh, this is not even necessary - once you have the data structure, just join the series using the delimiter, and serve it to the existing functions. it's a bit of overhead, and also requires camouflaging as a "frame" (basically a table with one item called "args").
:::the main thing is that the this module should not be tasked getting the data, and be limited to the presentation side.
:::write a module to harvest the data, synthesize it with parameters passed by the template(s), package the data series by joining with the delimiter and assign them to appropriate fields in the "args" table, and call this module to produce the chart.
:::something like so: <syntaxhighlight lang="lua">
-- this code is inside your exported function
local args = {}
-- synthesize args to be passed to the chart, from parameters passed to the module and harvested data
-- hack hack hack
-- "args" is ready
return require('Module:Chart').pieChart({ ['args'] = args } ) -- return chart to page
</syntaxhighlight>
:::will be interesting to see something like this in action.
:::if it makes a big diff for you, it will not be too painful to export "for modules only" function which will take the parameters a native lua table through and through. peace - [[User:קיפודנחש|קיפודנחש (aka kipod)]] ([[User talk:קיפודנחש|talk]]) 00:11, 25 May 2021 (UTC)
|