1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。

練習問題

Livebookで、動きのあるグラフを書け。

setup

Mix.install([
  {:vega_lite, "~> 0.1.5"},
  {:kino_vega_lite, "~> 0.1.7"},
  {:kino, "~> 0.10.0"}
])

サンプルコード

func = fn _, {v, x} ->
	Kino.VegaLite.push(v, %{
		x: x, 
		y: :math.sin(x)
	}, window: 100)
	{:cont, {v, x + 0.1}}
end
vega = Vl.new(width: 500, height: 400)
	|> Vl.mark(:line)
	|> Vl.encode_field(:x, "x", type: :quantitative)
	|> Vl.encode_field(:y, "y", type: :quantitative)
	|> Kino.VegaLite.new()
	|> Kino.render()
Kino.listen(500, {vega, 0}, func)

写真

image.png

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?