Requests for comment/Graph

Background
Graph extension is already live, but needs some improvements to be deployed on a massive scale for Wikipedia. Current implementation encodes graph definition (JSON) as an HTML data attribute. The client-side javascript library parses that big JSON blob and renders image on a canvas (Vega library). Graph can be defined with an embedded  tag, or can take up an entire Graph namespace page. Graph definition could contain data, or it may reference external data (by URL, WMF domains only)

Graph extension must support template expansion in order to be useful, e.g. A world map template could take a list of country codes to highlight. On the other hand, json itself could contain wiki-like elements, e.g. 123 (a list of lists).

Older browser support
Need to show PNG file instead of doing the complex client-side rendering whenever user's browser is not supported, or possibly if the network speeds are low. Vega can render PNGs server-side in a headless mode. The question is how to get graph definition to the nodejs rendering service. The definition could be fairly large to be included in the image URL as a parameter.

The graph tag extension / content handler would output an &lt;img> tag, with the PNG URL going either to the api, special page, or directly to nodejs service. That URL must include some way to identify the data definition that vega will need to convert. Currently, the data definition is known only at the parse time - since there could be some template expansions. Some ideas:
 * During the rendering, if there is a magic url param like "graphId=XXX"