Fix Chart appearance
All checks were successful
/ release (push) Successful in 30s

This commit is contained in:
Samuel Lorch 2024-07-13 03:46:55 +02:00
parent 38219f7b07
commit 091ef322d5

View file

@ -9,7 +9,6 @@ import (
"git.lastassault.de/speatzle/morffix/constants" "git.lastassault.de/speatzle/morffix/constants"
"github.com/go-echarts/go-echarts/v2/charts" "github.com/go-echarts/go-echarts/v2/charts"
"github.com/go-echarts/go-echarts/v2/opts" "github.com/go-echarts/go-echarts/v2/opts"
"github.com/go-echarts/go-echarts/v2/types"
"github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5"
) )
@ -52,18 +51,19 @@ func handleStats(w http.ResponseWriter, r *http.Request) {
pie := charts.NewPie() pie := charts.NewPie()
pie.SetGlobalOptions( pie.SetGlobalOptions(
charts.WithInitializationOpts(opts.Initialization{ charts.WithInitializationOpts(opts.Initialization{
Theme: types.ThemePurplePassion, Theme: "dark",
BackgroundColor: "#111",
}), }),
charts.WithTitleOpts(opts.Title{ charts.WithTitleOpts(opts.Title{
Title: "Codecs", Title: "Codecs",
})) }))
pie.AddSeries("Codecs", chartData).SetSeriesOptions(charts.WithLabelOpts( pie.AddSeries("Codecs", chartData).SetSeriesOptions(
opts.Label{ charts.WithLabelOpts(
Show: opts.Bool(true), opts.Label{
Formatter: "{b}: {c}", Show: opts.Bool(true),
Color: "white", Formatter: "{b}: {c}",
}), }),
) )
snippet := pie.RenderSnippet() snippet := pie.RenderSnippet()