There is this totally normal mix
Elixir project/repository (code and tests and stuff - just a library for now, no Phoenix or anything).
Then added a LiveBook notebook at notebooks/dicect.livemd
- needed some exploratory data visualization.
When this code is executed from the inside the LiveBook:
data = [
%{"category" => "A", "score" => 28},
%{"category" => "B", "score" => 55}
]
Vl.new()
|> Vl.data_from_values(data)
It returns:
** (Protocol.UndefinedError) protocol Enumerable not implemented for %Table.Mapper{enumerable: [%{"category" => "A", "score" => 28}, %{"category" => "B", "score" => 55}], fun: #Function<1.129280379/1 in Table.Mapper.map/2>} of type Table.Mapper (a struct). This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Range, Stream
(elixir 1.17.2) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.17.2) lib/enum.ex:166: Enumerable.reduce/3
(elixir 1.17.2) lib/enum.ex:4423: Enum.map/2
(vega_lite 0.1.10) lib/vega_lite.ex:304: VegaLite.data_from_values/3
#cell:r6qixazynpxprvhi:9: (file)
But, when it is run from the iex -S mix
prompt, it returns a VegaLite
data structure.
What is missing?
The setup part of the LiveBook:
Mix.install(
[
{:dicect, path: Path.join(__DIR__, ".."), env: :dev}
],
config_path: :dicect,
lockfile: :dicect
)
Current dependencies in mix.exs
are:
...
defp deps do
[
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:logger_json, "~> 6.1"},
{:vega_lite, "~> 0.1.10"},
{:kino, "~> 0.14.1"},
{:tucan, "~> 0.3.0"},
{:kino_vega_lite, "~> 0.1.8"}
]
end
...
- Also tried
tucan
, had a similar story - since it uses VegaLite I guess.