View Source Components
Mix.install([
{:vega_lite, "~> 0.1.6"},
{:kino_vega_lite, "~> 0.1.8"}
])
alias VegaLite, as: Vl
kinos
Kinos
vegalite
VegaLite
This integration automatically renders the VegaLite
struct as a chart:
Vl.new()
|> Vl.data_from_values(iteration: 1..100, score: 1..100)
|> Vl.mark(:line)
|> Vl.encode_field(:x, "iteration", type: :quantitative)
|> Vl.encode_field(:y, "score", type: :quantitative)
kino-vegalite
Kino.VegaLite
Kino.VegaLite
allows you to wrap an empty graphic and then stream
data to the chart:
chart =
Vl.new(width: 400, height: 400)
|> Vl.mark(:line)
|> Vl.encode_field(:x, "x", type: :quantitative)
|> Vl.encode_field(:y, "y", type: :quantitative)
|> Kino.VegaLite.new()
|> Kino.render()
for i <- 1..300 do
point = %{x: i / 10, y: :math.sin(i / 10)}
Kino.VegaLite.push(chart, point)
Process.sleep(25)
end
smart-cells
Smart cells
The following Smart cells are available:
- Chart cell - for building visualizations for tabular data