mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-16 21:28:03 +08:00
Do not use Kino.VegaLite.periodically
This commit is contained in:
parent
bf2fafe89d
commit
c350859e29
1 changed files with 2 additions and 3 deletions
|
|
@ -319,11 +319,11 @@ memory_plot =
|
||||||
|> Kino.VegaLite.new()
|
|> Kino.VegaLite.new()
|
||||||
```
|
```
|
||||||
|
|
||||||
Now we can use `Kino.VegaLite.periodically/4` to create a self-updating
|
Now we can use `Kino.listen/2` to create a self-updating
|
||||||
plot of memory usage over time on the remote node:
|
plot of memory usage over time on the remote node:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
Kino.VegaLite.periodically(memory_plot, 200, 1, fn i ->
|
Kino.listen(200, fn i ->
|
||||||
point =
|
point =
|
||||||
:erpc.call(node, :erlang, :memory, [])
|
:erpc.call(node, :erlang, :memory, [])
|
||||||
|> Enum.map(fn {type, bytes} -> {type, bytes / 1_000_000} end)
|
|> Enum.map(fn {type, bytes} -> {type, bytes / 1_000_000} end)
|
||||||
|
|
@ -331,7 +331,6 @@ Kino.VegaLite.periodically(memory_plot, 200, 1, fn i ->
|
||||||
|> Map.put(:iter, i)
|
|> Map.put(:iter, i)
|
||||||
|
|
||||||
Kino.VegaLite.push(memory_plot, point, window: 1000)
|
Kino.VegaLite.push(memory_plot, point, window: 1000)
|
||||||
{:cont, i + 1}
|
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue