Fix: show all the XAxis elements

This commit is contained in:
Óscar M. Lage 2024-12-05 17:42:15 +01:00
parent 37f5d50928
commit 5dac40aa86

View File

@ -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
}