Wikimedia Developer Support

How can we add vega-based graphs on a wiki via a gadget?

Vega-based graphs provided by Extension:Graph; I’m wondering how we can display them on a wiki page via a user script or Gadget code? I couldn’t find any documentation on this.

1 Like

https://www.mediawiki.org/w/index.php?title=Extension:Graph/Demo&action=edit&section=1

Like this?

I want to do so via a user script and not sure how I should approach this.

What script? Is it for “what you see is what you get” or what is the purpose of the script?

At a glance you can just do

mw.loader.load( 'ext.graph.vega2', function () {
    mw.drawVegaGraph( domElement, graphSpec, doneCallback );
} );
1 Like