From 361e6138d838b2c6f7979f73ffffa796b4fe0dd0 Mon Sep 17 00:00:00 2001 From: Rico Date: Tue, 8 Feb 2022 03:47:05 +0100 Subject: [PATCH] fix: use fixed length for left stroked legend The stroke length was just way too long, so I first tried to decrease the length by subtracting the padding from it, but it was not a big difference. I ended up using a hardcoded value because it gave the best visual results on different resolutions. --- legend.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/legend.go b/legend.go index ae32360..995df0c 100644 --- a/legend.go +++ b/legend.go @@ -145,6 +145,7 @@ func LegendLineLeft(c *Chart, userDefaults ...Style) Renderable { // DEFAULTS lineTextGap := 5 lineLengthMinimum := 25 + strokeLength := 17 var labels []string var lines []Style @@ -215,7 +216,7 @@ func LegendLineLeft(c *Chart, userDefaults ...Style) Renderable { ly := ty - th2 // Calculate line ending x coordinate - lx2 := lx + lineLengthMinimum - legendStyle.Padding.Left + lx2 := lx + strokeLength r.SetStrokeColor(lines[x].GetStrokeColor()) r.SetStrokeWidth(lines[x].GetStrokeWidth())