Make charts smaller
This commit is contained in:
@@ -89,7 +89,7 @@ defmodule MusicLibraryWeb.ChartComponents do
|
|||||||
|
|
||||||
defp calculate_bar_height(data, available_height) do
|
defp calculate_bar_height(data, available_height) do
|
||||||
bar_count = length(data)
|
bar_count = length(data)
|
||||||
max_height = min(30, (available_height - (bar_count - 1) * 4) / bar_count)
|
max_height = min(15, (available_height - (bar_count - 1) * 4) / bar_count)
|
||||||
max(20, max_height) |> trunc()
|
max(20, max_height) |> trunc()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -489,7 +489,7 @@
|
|||||||
<.vertical_bar_chart
|
<.vertical_bar_chart
|
||||||
data={@records_by_artist}
|
data={@records_by_artist}
|
||||||
width={600}
|
width={600}
|
||||||
height={35 * length(@records_by_artist)}
|
height={26 * length(@records_by_artist)}
|
||||||
color_class="fill-red-500"
|
color_class="fill-red-500"
|
||||||
label_fn={fn datum -> datum.name end}
|
label_fn={fn datum -> datum.name end}
|
||||||
value_fn={fn datum -> datum.count end}
|
value_fn={fn datum -> datum.count end}
|
||||||
@@ -511,7 +511,7 @@
|
|||||||
<.vertical_bar_chart
|
<.vertical_bar_chart
|
||||||
data={@records_by_genre}
|
data={@records_by_genre}
|
||||||
width={600}
|
width={600}
|
||||||
height={35 * length(@records_by_genre)}
|
height={26 * length(@records_by_genre)}
|
||||||
color_class="fill-zinc-500"
|
color_class="fill-zinc-500"
|
||||||
label_fn={fn {genre, _count} -> genre end}
|
label_fn={fn {genre, _count} -> genre end}
|
||||||
value_fn={fn {_genre, count} -> count end}
|
value_fn={fn {_genre, count} -> count end}
|
||||||
|
|||||||
Reference in New Issue
Block a user