Hello,
When using SWISH, I really liked the graphing capability using c3, but found it a bit limiting.
I have previously used vega-lite and seems to be really similar to c3, where the whole graph is defined in json.
I have tried to render a self-contained html rendering of a vega-lite graph but the swish notebook gives me an error vegaEmbed not defined.
How hard would it be to embed vega-lite in swish like for c3 ?
Probably not too hard. You could try with a local copy. There is a JS plugin system, see e.g. config-available/plugin_slider.pl. Possibly that works for vega-lite as well. If it works and you add the necessary usage pages as there exist for the other rendering frameworks, I’m happy to merge a PR.
From what I can understand, the vega-lite library depends on vega.js and vega-embed depends on both vega.js and vega-lite.js which it doesn’t find.
Is this because the plugin system doesn’t support dependencies ?
I think the problem is with require.js. See end of swish.js where the plugins are collected and loaded by means of require(). I think the route is to install vega as an npm module and use local paths.
But … my JavaScript is a little rusty at the moment …
It actually works without the schema line (the vega-lite format doesn’t requires it, it is just good practice).
The vega-lite online editor help says this about the schema line:
URL to JSON schema for a Vega-Lite specification. Unless you have a reason to change this, use [https://vega.github.io/schema/vega-lite/v6.json](Vega Editor). Setting the $schema property allows automatic validation and autocomplete in editors that support JSON schema.
Thanks to you! Note that if you try this, you may have to do a shift-reload to make sure to get the latest JavaScript. If the examples do not show up, your browser cache is the most likely culprit.