Add livebook chart with descending genre count

This commit is contained in:
Claudio Ortolina
2025-02-10 10:24:46 +00:00
parent f99a55fca7
commit b02a44f495
+8
View File
@@ -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")
```
<!-- livebook:{"attrs":"eyJjaGFydF90aXRsZSI6IkNvdW50IGJ5IGdlbnJlIiwiaGVpZ2h0IjpudWxsLCJsYXllcnMiOlt7ImFjdGl2ZSI6dHJ1ZSwiY2hhcnRfdHlwZSI6ImJhciIsImNvbG9yX2ZpZWxkIjpudWxsLCJjb2xvcl9maWVsZF9hZ2dyZWdhdGUiOm51bGwsImNvbG9yX2ZpZWxkX2JpbiI6bnVsbCwiY29sb3JfZmllbGRfc2NhbGVfc2NoZW1lIjpudWxsLCJjb2xvcl9maWVsZF90eXBlIjpudWxsLCJkYXRhX3ZhcmlhYmxlIjoiY291bnRfYnlfZ2VucmUiLCJnZW9kYXRhX2NvbG9yIjoiYmx1ZSIsImxhdGl0dWRlX2ZpZWxkIjpudWxsLCJsb25naXR1ZGVfZmllbGQiOm51bGwsInhfZmllbGQiOiJjIiwieF9maWVsZF9hZ2dyZWdhdGUiOm51bGwsInhfZmllbGRfYmluIjpudWxsLCJ4X2ZpZWxkX3NjYWxlX3R5cGUiOm51bGwsInhfZmllbGRfdHlwZSI6InF1YW50aXRhdGl2ZSIsInlfZmllbGQiOiJ2YWx1ZSIsInlfZmllbGRfYWdncmVnYXRlIjpudWxsLCJ5X2ZpZWxkX2JpbiI6bnVsbCwieV9maWVsZF9zY2FsZV90eXBlIjpudWxsLCJ5X2ZpZWxkX3R5cGUiOiJub21pbmFsIn1dLCJ2bF9hbGlhcyI6IkVsaXhpci5WZWdhTGl0ZSIsIndpZHRoIjo2MDB9","chunks":null,"kind":"Elixir.KinoVegaLite.ChartCell","livebook_object":"smart_cell"} -->
```elixir