Skip to content

Commit 5326c1c

Browse files
nponeccopclaude
authored andcommitted
refactor: use D3 .raise() for element reordering
Replace vanilla appendChild() calls with idiomatic D3 .raise() method when reordering zoom overlay and brush layer elements after resetData(). This change: - Uses D3's declarative API instead of mixing D3 selections with DOM APIs - Better expresses intent (bring to front vs append) - Maintains same performance and behavior - Continues refactoring toward more idiomatic D3 patterns Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2d566db commit 5326c1c

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

svg-time-series/src/draw.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,8 @@ export class TimeSeriesChart {
174174
this.data.replace(source);
175175
this.state.destroy();
176176
this.state = setupRender(this.svg, this.data);
177-
const svgNode = this.svg.node();
178-
if (svgNode) {
179-
svgNode.appendChild(this.zoomArea.node()!);
180-
svgNode.appendChild(this.brushLayer.node()!);
181-
}
177+
this.zoomArea.raise();
178+
this.brushLayer.raise();
182179
const context = this.state.createLegendContext(this.data);
183180
this.legendController.init(context);
184181
this.zoomState.destroy();

0 commit comments

Comments
 (0)