Commit 1fcca30
feat: Add Percentile-Based Bounds for colorByValue (#319)
* Allow lowerBound, upperBound, and breakpoints to accept percentage strings
(e.g. "25%") that resolve to percentiles of the actual data distribution,
in addition to static numeric values.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* When colorByValue uses percentage-based bounds, legend labels now display
≤/> notation instead of plain values with +, making it clear the bounds
represent percentiles. Also removes duplicate utility functions from the
merge and properly types raw config with string bounds.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* #196 fix: remove duplicate NumberOrPercent class and fix formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* #196 feat: add V5 schema with percentile support for colorByValue bounds
Introduces GeoSetLayerV5Schema that extends colorByValue bounds and
breakpoints to accept percentile strings (e.g. "10%", "90%") via
NumberOrPercent. Simplifies V1 ColorByValueSchema to numeric-only,
keeping the percentile logic cleanly in V5.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* update chart configs to schema version 5 and simplify V5 test fixture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address code review findings for percentile bounds and dynamic sizing
- Use copy.deepcopy in V5 schema upgrade (was shallow copy)
- Pass resolved metric config instead of raw colorByValue to fix type safety
- Remove unnecessary `as any` casts for sizeValue on GeoJsonFeature
- Extract shared formatBoundLabel utility to eliminate duplication across 4 components
- Add NaN guard in computeSizeScale for defense-in-depth
- Remove file-level rules-of-hooks eslint disable in MultiLegend
- Simplify isCombinedMetricSize from IIFE to plain boolean expression
- Remove non-null assertion on sizeScale (already narrowed by if)
- Tighten V5 upgrade immutability test to check nested object identity
- Add clarifying comment in V5 validator about mixed-type validation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: use isPercentString utility for percent bound detection
Replace inline typeof/endsWith checks with the existing isPercentString
utility for consistency and stricter validation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove unused `import re` from GeoSetLayerV1Schema
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: import SizeLegend type instead of inlining it in transformProps
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add console warnings for inverted bounds and expand V5 schema test coverage
Add console.warn when resolved percentile bounds produce lower > upper
for both colorByValue and pointSize. Add tests for all-percentage config
happy path and mixed-type breakpoint ordering skip behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor: extract resolveNumericBounds to deduplicate metric/size percentile logic
The metric coloring and point sizing blocks in transformProps shared
identical logic for value extraction, sorting, bound resolution, warnings,
and percent-bound detection. Consolidates into a single resolveNumericBounds
helper in colors.ts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: map breakpoint segments to correct slice of global color gradient
Each breakpoint segment was independently cycling through the full color
range because the local interpolation factor (t) was passed directly to
the full-range interpolator. Replace interp(t) with
interp((i + t) / numSegments) so each segment maps to its proportional
slice of the start→end color ramp.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: simplify V5 schema validation and update docs for percentile colorByValue bounds
Flatten the branching validation logic in ColorByValueSchemaV5 into three
linear steps (bounds ordering, breakpoint ordering, breakpoints-in-range)
and extract _is_pct/_to_float helpers. Update wiki pages and README to
document percentile string support for colorByValue bounds and breakpoints.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* add frontend unit tests and extract shared schema bound validation
- Add 63 unit tests covering isPercentString, percentile,
resolvePercentOrNumber, resolveNumericBounds, computeMetricColorScaleUnified,
computeSizeScale, formatLegendNumber, and formatBoundLabel
- Extract validate_bound_ordering, _is_pct, _to_float from V4 schema
as shared helpers; V5 now imports them instead of duplicating
- Breakpoint color test verifies monotonic gradient (no segment reset)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* cleanup: default param, rename private helpers, add JSDoc note
- Default usesPercentBounds to false in formatBoundLabel
- Rename _is_pct/_to_float to is_pct/to_float (now cross-module public)
- Add JSDoc note on inverted bounds degenerate case in resolveNumericBounds
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: lhawkins <lhawkins@teamraft.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ethan Bienstock <ethan.bienstock@acf.hhs.gov>1 parent d599ead commit 1fcca30
27 files changed
Lines changed: 1467 additions & 163 deletions
File tree
- superset-frontend/plugins/geoset-map-chart
- src
- GeoSetMultiMap
- components
- layers
- GeoSetLayer
- utils
- test/utils
- superset
- examples/geoset_configs/charts/GeoSet
- geoset_map
- schemas
- tests/unit_tests/geoset_map/schemas
- wiki
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| 416 | + | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
| |||
Lines changed: 10 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
Lines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
Lines changed: 21 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
170 | 177 | | |
171 | 178 | | |
172 | 179 | | |
173 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
174 | 186 | | |
175 | 187 | | |
176 | 188 | | |
| |||
242 | 254 | | |
243 | 255 | | |
244 | 256 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
253 | 263 | | |
254 | 264 | | |
255 | 265 | | |
| |||
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
396 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
397 | 411 | | |
398 | 412 | | |
399 | 413 | | |
| |||
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
415 | | - | |
416 | | - | |
| 414 | + | |
417 | 415 | | |
418 | 416 | | |
419 | 417 | | |
| |||
431 | 429 | | |
432 | 430 | | |
433 | 431 | | |
434 | | - | |
| 432 | + | |
435 | 433 | | |
436 | 434 | | |
437 | 435 | | |
| |||
451 | 449 | | |
452 | 450 | | |
453 | 451 | | |
454 | | - | |
455 | | - | |
456 | | - | |
| 452 | + | |
457 | 453 | | |
458 | 454 | | |
459 | 455 | | |
| |||
466 | 462 | | |
467 | 463 | | |
468 | 464 | | |
469 | | - | |
| 465 | + | |
470 | 466 | | |
471 | 467 | | |
472 | 468 | | |
| |||
1153 | 1149 | | |
1154 | 1150 | | |
1155 | 1151 | | |
| 1152 | + | |
1156 | 1153 | | |
1157 | 1154 | | |
1158 | 1155 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments