observablehq / vega

Convenience methods for using Vega and Vega-Lite in Observable.
https://observablehq.com
42 stars 7 forks source link

Use the SVG renderer #7

Closed visnup closed 5 years ago

visnup commented 6 years ago

The default otherwise is "canvas", but it feels like SVG would be more appropriate for most Observable usage.

This could be opt-in via either yet another module or duplicating this into svg.js and using longer require syntax from a notebook:

vegalite = require("@obserablehq/vega-lite/svg.js")
mbostock commented 6 years ago

Why would SVG be more appropriate? I feel like using the Vega default would be more appropriate?

Though, it’d still be nice to let you choose, say by letting vegalite take an optional options argument.

visnup commented 6 years ago

The specific use-case I run into is doing any searching in page for text, which fails against canvas-rendered content. Everything else to me in observable is text/markup-friendly, though I'm probably consciously ignoring all of the WebGL things.

For an options argument, something like:

vegalite(spec, { renderer: "svg" })

?

domoritz commented 6 years ago

I'm working on a fork that uses Vega-Embed and would support cusotmizing the renderer among many other things. I will send a PR when I've cleaned ups some messy hacks.

visnup commented 5 years ago

Prefer https://github.com/vega/vega-observable

domoritz commented 5 years ago

Actually, I recommend that you use https://github.com/vega/vega-embed instead.