From b02a44f4959ad12b50e8faa5a746c38035ccc462 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Mon, 10 Feb 2025 10:24:46 +0000 Subject: [PATCH] Add livebook chart with descending genre count --- music_library.livemd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/music_library.livemd b/music_library.livemd index 6fd1b9e8..58512c38 100644 --- a/music_library.livemd +++ b/music_library.livemd @@ -71,6 +71,14 @@ count_by_genre = ) ``` +```elixir +VegaLite.new(width: 600, title: "Count by genre (alt)") +|> VegaLite.data_from_values(count_by_genre, only: ["c", "value"]) +|> VegaLite.mark(:bar) +|> VegaLite.encode_field(:x, "c", type: :quantitative) +|> VegaLite.encode_field(:y, "value", type: :nominal, sort: "-c") +``` + ```elixir