Commit 17659e8
feat(app): legend + colors follow the highest-weighted category
Until now the colored borders and the legend were hardcoded to the
top-7 plot_types. With the weight sliders now letting the user dial
up any category, the same buckets stayed colored even when "styling"
became the dominant similarity signal — useful colors but mismatched
to the actual clustering driver.
Compute an `activeCategory` from the current weights (max wins;
ties go to plot_type because it's first in TAG_CATEGORIES and we
use strictly-greater compare). The legend now shows the active
category name as a caption + the top-7 values from THAT category
with their counts, and node border colors track the same buckets.
Falls back to plot_type when all weights are zero.
Refactored the helpers to be category-generic:
- primaryCategoryValue(spec, category) — replaces primaryPlotType,
with primaryPlotType kept as a thin wrapper for compatibility.
- categoryValueCounts(specs, category) — replaces plotTypeCounts.
- topCategoryValues(specs, category, n) — replaces topPlotTypes.
- SPEC_LEVEL_CATEGORIES const distinguishes spec-level (plot_type,
features, data_type, domain) from impl-level (the rest) so the
helper looks up the right tag dict on the spec.
Refs #5646
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent db24af7 commit 17659e8
2 files changed
Lines changed: 84 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
285 | 293 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
289 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
290 | 307 | | |
291 | | - | |
| 308 | + | |
292 | 309 | | |
293 | 310 | | |
294 | 311 | | |
295 | | - | |
296 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
297 | 315 | | |
298 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
299 | 320 | | |
300 | 321 | | |
301 | | - | |
302 | | - | |
303 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
304 | 325 | | |
305 | 326 | | |
306 | 327 | | |
307 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
308 | 334 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
312 | 338 | | |
313 | | - | |
314 | | - | |
| 339 | + | |
| 340 | + | |
315 | 341 | | |
316 | | - | |
317 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
318 | 348 | | |
319 | 349 | | |
320 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
321 | 356 | | |
322 | 357 | | |
323 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
163 | 179 | | |
164 | 180 | | |
165 | 181 | | |
| |||
169 | 185 | | |
170 | 186 | | |
171 | 187 | | |
172 | | - | |
173 | | - | |
| 188 | + | |
| 189 | + | |
174 | 190 | | |
175 | | - | |
| 191 | + | |
176 | 192 | | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
180 | | - | |
| 196 | + | |
181 | 197 | | |
182 | 198 | | |
183 | 199 | | |
184 | 200 | | |
185 | 201 | | |
186 | 202 | | |
187 | 203 | | |
188 | | - | |
| 204 | + | |
189 | 205 | | |
190 | 206 | | |
191 | 207 | | |
| |||
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
282 | 300 | | |
283 | 301 | | |
284 | 302 | | |
| |||
294 | 312 | | |
295 | 313 | | |
296 | 314 | | |
| 315 | + | |
297 | 316 | | |
298 | 317 | | |
299 | 318 | | |
| |||
0 commit comments