Extension:Graph/Vega 2.0/fr

This page is a translated version of the page Extension:Graph/Vega 2.0 and the translation is 33% complete.

Cela n'est pas souvent une bonne idée que d'avoir un graphique personnalisé dans un article. Il est beaucoup mieux d'utiliser un modèle commun tel que GraphChart, qui va générer le graphique pour vous.

Migration

Vega 1.0 et Vega 2.0 ne sont pas compatibles et ne demandent pas habituellement beaucoup de modifications pour la mise à jour. 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.

<graph>
{
    "version": 2,
    ...
}
</graph>

Etapes de migration souvent observées

The GraphChart template based on Lua module was recently migrated with all these steps:

  • Add "version": 2 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