Extension:Graph/Vega 2.0

It is rarely a good idea to have a custom graph in an article. It is far better to use a common template like GraphChart, which will generate the graph for you.

Migration
Vega 1.0 and 2.0 are not compatible, but usually do not require [https://github.com/vega/vega2-docs/wiki/Upgrading-to-2.0 too many modifications] to upgrade. Yet, multiple versions cannot peacefully coexist within the same browser session (at least not easily). This means that in the edit preview, if there are any 2.0 graphs on the page, you might not see the 1.0 graphs. At the same time, both graph versions will show when reading a page, because the rendering is done on the server.

To identify graph version, please add a "version" value at the top. Without it, the site default will be used. For now, it is 1, but once all graphs are marked with the version, we will switch it to 2.

Frequently Seen Migration Steps
The GraphChart template based on Lua module was [https://en.wikipedia.org/w/index.php?title=Module%3AGraph&type=revision&diff=694867222&oldid=670068988 recently migrated] with all these steps:


 * Add   at the top of the graph


 * Remove the "data." prefix: replace all "data.variable" with "variable".


 * Replace "zip" transformation with "lookup", "stats" with "aggregate"


 * Fix field names generated by transformations, e.g. y → layout_start, y2 → layout_end, path → layout_path, sum → sum_variable


 * See [https://github.com/vega/vega2-docs/wiki/Upgrading-to-2.0 complete list of changes]