From 5dac40aa868deae9dd90f6f103656c8e3d954a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Thu, 5 Dec 2024 17:42:15 +0100 Subject: [PATCH] Fix: show all the XAxis elements --- internal/web/utils.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/web/utils.go b/internal/web/utils.go index e8138a7..f6209c3 100644 --- a/internal/web/utils.go +++ b/internal/web/utils.go @@ -93,6 +93,13 @@ func createBarChart(stats []CommandStat) *charts.Bar { Title: "Top Commands", Subtitle: "Most used commands", }), + charts.WithXAxisOpts(opts.XAxis{ + AxisLabel: &opts.AxisLabel{ + Show: opts.Bool(true), + Interval: "0", + Rotate: 45, + }, + }), ) commands := make([]string, len(stats)) @@ -103,13 +110,7 @@ func createBarChart(stats []CommandStat) *charts.Bar { } bar.SetXAxis(commands). - AddSeries("Freq", generateBarItems(counts)). - SetSeriesOptions( - charts.WithLabelOpts(opts.Label{ - Color: "white", - Position: "top", - }), - ) + AddSeries("Freq", generateBarItems(counts)) return bar } @@ -119,6 +120,7 @@ func generateBarItems(data []int) []opts.BarData { for i, v := range data { items[i] = opts.BarData{Value: v} } + log.Printf("items: %#v", items) return items }