livebook-dev / vega_lite

Elixir bindings for Vega-Lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't seem to get a slider to show

cigrainger opened this issue · comments

Here's a minimal example:

Vl.new()
|> Vl.data_from_url("https://vega.github.io/editor/data/cars.json")
|> Vl.mark(:circle)
|> Vl.param("grid", select: :interval, bind: :scales)
|> Vl.param("brush", select: :interval, bind: [input: :range, min: 0, max: 1000])
|> Vl.encode_field(:x, "Horsepower", type: :quantitative)
|> Vl.encode_field(:y, "Miles_per_Gallon", type: :quantitative)
|> Vl.encode(:size, param: "brush", value: 10)

I've bashed my head against this for a while, trying all sorts of different things that seem to match up with the Vega-lite guides but.... no luck. Help? 🙏 I'm sure it's me rather than a bug.

@cigrainger remove select: :interval and you should be good, it denotes a parameter where you select a part of the plot itself.

Let's keep the issue open, I will add a validation to ensure only one type is passed :)

Ahhhh thanks @jonatanklosko! I've been finding it quite confusing to translate things around interactivity. That makes sense and works!

Ah, apparently there are some cases where we would have both :select and :bind, so the validation wouldn't make sense. I added an example with range input and one expression though.