There are a lot of potential uses of data transforms that are opened up by allowing invocation-time arguments to be passed down to the Lua code.
Spike implementation tests this:
- take arg:<key>=<value> pairs from the invocation and combine them with the args in the .chart JSON's transform.args map
- simplest thing that can possibly work, plus a prefix to avoid config space collision
- pass the combined arguments down to JCContentLoader which passes them into the local or remote script
Example:
<!-- Plot all population estimates for London ordered by point in time -->
{{#chart:Wikidata population by year|width=400|arg:entity=Q84|arg:sort=desc}}where the underlying transform Lua code passes the "entity" and "sort" arguments down into wikibase functions. This wouldn't require creating a new .chart for each city or country any longer.
Recommending we separate the args from chart args to keep things clean.
- we could prefix things to avoid namespace collisions
- arg:<key>=<val> (current patch)
- {{#chart:Wikidata population by year|width=400|arg:entity=Q84|arg:sort=desc}}
- arg=<key>=<val>
- {{#chart:Wikidata population by year|width=400|arg=entity=Q84|arg=sort=desc}}
- arg:<key>=<val> (current patch)
- or separate them
- |args=
- {{#chart:Wikidata population by year|width=400|args=entity=Q84|sort=desc}}
- |args:
- {{#chart:Wikidata population by year|width=400|args:entity=Q84|sort=desc}}
- |args|
- {{#chart:Wikidata population by year|width=400|args|entity=Q84|sort=desc}}
- |args=