sort by x

main
Bel LaPointe 2024-02-21 13:28:45 -07:00
parent 0dc484047c
commit 3ff2bf0c91
1 changed files with 5 additions and 1 deletions

View File

@ -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
}