Translate VEGA-Lite or VEGA chart specification to Grafana

Viewed 444

My preferred chart specification language is VEGA-Lite (that can be compiled to VEGA)... But I need to translate later to a fragment into a complete template of Grafana dashboard specification.

It is possible to do automatic or semi-automatic translation? Or maybe there are a good guide, explaining the main "clues for translation".


NOTES

  • Translation procedures are not simple, I'm aware... Perhaps a good start point is to test the simplest: VEGA-Lite bar chart to Grafana ones.

  • We use some "JSON templating" on the top of VEGA-Lite. We don't have time and resources, but our needs are not so complex... The final "translation solution" must be useful:
    1. to maintain Grafana dashboards or "Grafana chart templates";
    2. to use VEGA-Lite (JSON and visualization) as "inspiration" for the development of Grafana dashboard-templates.
    The context is like an agile methodology that starts with a lot of VEGA-Lite charts and, for some elected charts, end with Grafana... So, we are resigned/accepting a coarse translation process.

1 Answers

Sure, it is possible to write translation/parser.

But:

  • I wouldn't expect that someone already made it -> you will need to code it
  • Grafana functionality is not the same as VEGA-Lite functionality -> you will have undefined cases
  • Grafana dashboard model is not very well documented -> you may need reverse engineering and model can be changed before minor Grafana releases (for example recent Grafana 7.0.0 has schemaVersion 25 -> 25 different dashboard models exists historically = 25 different grammars if you want comprehensive implementation)

Go ahead if you have time and resources. https://grafana.github.io/grafonnet-lib/ can be useful here.

Related