diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-29 15:22:38 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-29 15:22:38 -0500 |
| commit | 9231bacd968b7053f9bfede99abcf5a880cc8e67 (patch) | |
| tree | c16919ef4ab2ed2e00f53f3a8876b971e9f944ac /server/chart.go | |
| parent | cee1d301809ec0b517962816b1b232c22a41eb3b (diff) | |
| download | soen422-9231bacd968b7053f9bfede99abcf5a880cc8e67.zip | |
server dashboard: chart axis labels
Diffstat (limited to 'server/chart.go')
| -rw-r--r-- | server/chart.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/chart.go b/server/chart.go index 4d7298b..8e326ca 100644 --- a/server/chart.go +++ b/server/chart.go @@ -29,14 +29,17 @@ func (h HumidityChartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) } graph := chart.Chart{ + Title: "Humidity per Room", Background: chart.Style{ Padding: chart.Box{Top: 20, Left: 20}, }, Series: buildSortedSeries(h.building), XAxis: chart.XAxis{ + Name: "time", ValueFormatter: chart.TimeMinuteValueFormatter, }, YAxis: chart.YAxis{ + Name: "relative humidity (%)", Range: &chart.ContinuousRange{Min: minHumidity, Max: maxHumidity}, }, } @@ -69,6 +72,7 @@ func (h DutyCycleChartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) } graph := chart.Chart{ + Title: "Duty Cycle", Background: chart.Style{ Padding: chart.Box{Top: 20, Left: 20}, }, @@ -76,9 +80,11 @@ func (h DutyCycleChartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) chart.TimeSeries{XValues: x, YValues: y}, }, XAxis: chart.XAxis{ + Name: "time", ValueFormatter: chart.TimeMinuteValueFormatter, }, YAxis: chart.YAxis{ + Name: "duty cycle (%)", Range: &chart.ContinuousRange{Min: minDutyCycle, Max: maxDutyCycle}, }, } |