disable chart legend

This commit is contained in:
r0n1n7an 2024-05-02 00:55:02 +08:00
parent 1b1ee673bb
commit 09eae78899
2 changed files with 17 additions and 13 deletions

Binary file not shown.

View File

@ -191,18 +191,21 @@ func eChart(w http.ResponseWriter, r *http.Request) {
chartSeries := cfg.Section("Chart").Key("Series").String() chartSeries := cfg.Section("Chart").Key("Series").String()
assetsURL := cfg.Section("Chart").Key("AssetsURL").String() assetsURL := cfg.Section("Chart").Key("AssetsURL").String()
var xPercent float32 = 75 var xPercent float32 = 0
if params.Range == "all" { if params.Range == "all" {
xPercent = 0 xPercent = 0
} }
if params.Range == "half" { if params.Range == "3days" {
xPercent = 50 xPercent = 57.14
} }
if params.Range == "quarter" { if params.Range == "2days" {
xPercent = 75 xPercent = 71.42
} }
if params.Range == "octant" { if params.Range == "1day" {
xPercent = 87.5 xPercent = 85.71
}
if params.Range == "12hrs" {
xPercent = 92.85
} }
if params.Alias != "" { if params.Alias != "" {
chartSubtitle = params.Alias chartSubtitle = params.Alias
@ -257,13 +260,14 @@ func eChart(w http.ResponseWriter, r *http.Request) {
Min: "dataMin", Min: "dataMin",
Max: "dataMax", Max: "dataMax",
AxisLabel: &opts.AxisLabel{ AxisLabel: &opts.AxisLabel{
Show: true,
ShowMinLabel: true, ShowMinLabel: true,
ShowMaxLabel: true, ShowMaxLabel: true,
Rotate: 45, Rotate: 45,
FontSize: "14", FontSize: "14",
FontWeight: "600", FontWeight: "600",
FontFamily: "Calibri", FontFamily: "Calibri",
LineHeight: "200", LineHeight: "250",
}, },
}, },
), ),
@ -290,11 +294,11 @@ func eChart(w http.ResponseWriter, r *http.Request) {
}, },
}, },
), ),
// charts.WithLegendOpts( charts.WithLegendOpts(
// opts.Legend{ opts.Legend{
// Show: true, Show: false,
// }, },
// ), ),
) )
chart.SetXAxis(timeAxis).AddSeries(chartSeries, dots). chart.SetXAxis(timeAxis).AddSeries(chartSeries, dots).