diff --git a/internal/web/charts2.go b/internal/web/charts2.go index 48d42a7..41e2bf3 100644 --- a/internal/web/charts2.go +++ b/internal/web/charts2.go @@ -54,7 +54,7 @@ func HBarChart(rows []Row, colour, unit string) template.HTML { plotW := width - labelW - valueW var b strings.Builder - fmt.Fprintf(&b, `
`, width, height) for i, r := range rows { diff --git a/internal/web/charts2_test.go b/internal/web/charts2_test.go index 42efd46..fabb221 100644 --- a/internal/web/charts2_test.go +++ b/internal/web/charts2_test.go @@ -115,3 +115,34 @@ func TestTheChartScalesToItsContainer(t *testing.T) { t.Error("a fixed pixel width was set on the chart") } } + +func TestTheRankedWrapperIsNotGivenAFixedHeight(t *testing.T) { + // This chart grows a row at a time, so whatever class it wears must not be + // one the stylesheet caps. It wore "chart", which is the fixed-height box + // the time-series charts live in, and the bars spilled over the table + // underneath them. + out := string(HBarChart([]Row{{Label: "a", Value: 1}}, "", "")) + class := "" // the wrapper's class, read back out of the markup + if i := strings.Index(out, `