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