From 3ff2bf0c91ac79ae631dbe0335c45a9689edd400 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:28:45 -0700 Subject: [PATCH] sort by x --- config.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 54e8178..ffb6bfb 100644 --- a/config.go +++ b/config.go @@ -7,6 +7,7 @@ import ( "log" "net/url" "os" + "sort" "slices" @@ -33,7 +34,7 @@ type Data struct { } func newConfig() (Config, error) { - dataPoints := envOr("DATA_POINTS", `[[[11, 21], [12, 22]], [[12, 21], [14, 23]]]`) + dataPoints := envOr("DATA_POINTS", `[[[11, 21], [12, 22], [12, 21], [14, 23]]]`) dataLabels := envOr("DATA_LABELS", ``) dataWeightRange := envOr("DATA_WEIGHT_RANGE", `20`) dataWeightFloor := envOr("DATA_WEIGHT_FLOOR", `12`) @@ -194,5 +195,8 @@ func weighXYasZ(input [][]float64) [][]float64 { result = append(result, []float64{x, y, z}) } } + sort.Slice(result, func(i, j int) bool { + return result[i][0] < result[j][0] + }) return result }