Repository navigation
Conversation
|
There was a problem hiding this comment.
1 issue found across 15 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="viz-lib/src/visualizations/sunburst/initSunburst.ts">
<violation number="1" location="viz-lib/src/visualizations/sunburst/initSunburst.ts:263">
P3: Add a Cypress interaction test that moves between sunburst segments and verifies highlighting and breadcrumb placement; a static snapshot does not exercise the migrated hover behavior.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // helper function mouseover to handle mouseover events/animations and calculation | ||
| // of ancestor nodes etc | ||
| function mouseover(d: any) { | ||
| function mouseover(event: MouseEvent, d: any) { |
There was a problem hiding this comment.
P3: Add a Cypress interaction test that moves between sunburst segments and verifies highlighting and breadcrumb placement; a static snapshot does not exercise the migrated hover behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At viz-lib/src/visualizations/sunburst/initSunburst.ts, line 263:
<comment>Add a Cypress interaction test that moves between sunburst segments and verifies highlighting and breadcrumb placement; a static snapshot does not exercise the migrated hover behavior.</comment>
<file context>
@@ -271,7 +260,7 @@ export default function initSunburst(data: any) {
// helper function mouseover to handle mouseover events/animations and calculation
// of ancestor nodes etc
- function mouseover(d: any) {
+ function mouseover(event: MouseEvent, d: any) {
// build percentage string
const percentage = ((100 * d.value) / totalSize).toPrecision(3);
</file context>
There was a problem hiding this comment.
Same as the other sunburst thread: reasonable, better placed in the Playwright suite.
ba68eec to
3d57946
Compare
17aacee to
cb82389
Compare
682aa1f to
900d1c1
Compare
cb82389 to
5a1c8a9
Compare
Port the d3 3 code in viz-lib (box plot, sankey, sunburst, word cloud, pie and heatmap colors, map colors, the Albers USA projection script) and client/app/components/Resizable to d3 7: - scales, axes, arcs and projections move to their d3 4+ names (scaleBand/scaleLinear/scaleOrdinal, axisBottom/…, arc, geo*) - d3.layout.partition → d3.hierarchy + d3.partition. Keep d3 3's behavior: children sorted by value, leaf-only values, and nodes collected in pre-order before sorting (that order decides the colors). - d3.nest → d3.group(s); d3.functor, d3.timer.flush → inline, timerFlush - event listeners get (event, datum) since d3 6 - enter selections are no longer merged into the update selection, so merge them for the sunburst breadcrumbs - category20 was removed from d3; keep d3 3's list as D3Category20 - keep d3 3's results where d3 4+ changed defaults: the "swing" easing (which d3 3 treated as linear), word sizes when all counts are equal, and the Mercator scale the committed usa-albers.geo.json was built with - d3box.ts used a global `d3` that only existed because d3 3's bundle took its AMD branch under webpack; import it instead Jest: add d3 7 and its ESM-only dependencies to the transform lists, in the client and in viz-lib. Part of #7848. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
d3 4+ axes place tick and grid lines half a pixel differently, which shifts the box plot's grid lines by a sub-pixel amount.
5a1c8a9 to
109059d
Compare
What type of PR is this?
Description
Part 8 of the frontend dependency upgrade stack tracked in #7848. Stacked on #7857.
Ports the d3 3 code to d3 7: viz-lib's box plot, sankey, sunburst, word cloud, pie/heatmap colors, map colors and the Albers USA projection script, plus the client's
Resizable. Plotly no longer holds this back: since plotly.js 2 (#7359), it depends on individual d3 modules rather than thed3package.API changes handled
scaleBand,scaleLinear,scaleOrdinal,axisBottom/Left/Right,arc,geoAlbersUsa/geoMercator).d3.layout.partitionbecomesd3.hierarchy+d3.partition.d3.nestbecomesd3.group/groups.d3.functorandd3.timer.flushbecome an inline equivalent andtimerFlush.(event, datum)since d3 6, which affects the sankey and sunburst mouseover handlers.merge(), the sunburst's breadcrumbs lost their positions and stacked on top of each other; the comparison below caught this.Where d3 7 changed behavior, the port keeps d3 3's results
undefined, which produced aNaNoffset. The offset uses 0 in that case, as before.currentColor, which turned the tick labels gray. The box plot's axes are styled black, as before.category20, which d3 removed, is kept asD3Category20with d3 3's colors (sankey, word cloud).ease("swing"), which d3 3 didn't know and treated as linear, so it now useseaseLinear.convert-projection.ts(offline script): pinned to d3 3's default Mercator scale (150; d3 4+ uses ~152.6).A latent bug, fixed:
box-plot/d3box.tsused a globald3it never imported. That global only existed because d3 3's UMD bundle takes its AMD branch under webpack and assignsthis.d3. It now imports d3.How is this tested?
Unit tests (pytest, jest)
Manually
Lint, type-check (client and viz-lib), jest (client 96, viz-lib 154, no snapshot changes; the pie and heatmap fixture tests cover the color scales) and the production build pass locally.
Rendering comparison: I rendered the sankey, the sunburst (both data formats, plus the hover state) and the box plot in jsdom with the same data, using the previous code on d3 3.5.17 and this code on d3 7.9.0, then diffed the SVG:
rgb(…)instead of hex, and d3 7 roundsdarker()channels where d3 3 truncated, so some differ by 1.Visual tests (Add Playwright visual tests for visualizations, remove Percy #7853): pixel-identical to the previous step, except the box plot, whose grid lines shift by a sub-pixel amount (d3 4+ axis offsets). Its baseline is updated in a separate commit.
Regenerated
usa-albers.geo.jsonwith the ported script: all 13,380 coordinates match the committed file (max difference 2e-13).Bundle size: the vendor chunk grows by about 158 KB (uncompressed). viz-lib's
lib/is CommonJS, so webpack can't tree-shake d3 and includes all of d3 7. Buildinglib/as ES modules would fix that; it's a follow-up because the client's Jest setup currently relies onlib/being CommonJS.🤖 Generated with Claude Code