-
Notifications
You must be signed in to change notification settings - Fork 41
Description
When applying a filter in the eventUsageMetrics Lightning Web Component (via the handleFilterChange method), the D3 chart is duplicated within the same .timeline container instead of being replaced. This results in multiple overlapping charts being rendered on the screen, causing visual clutter and performance issues. The bug occurs because existing elements in the .timeline container are not cleared before the new chart is rendered.
Steps to Reproduce:
- Load the eventUsageMetrics LWC to display the initial chart.
- Trigger a filter change by interacting with the filtering options (e.g., selecting an event type or applying a date range).
- Observe that a new chart is rendered on top of the existing one without removing the previous chart.
Expected Behavior
The chart should be replaced with the updated filtered data, ensuring that only one chart is visible at any time.
Actual Behavior
The chart is duplicated once and each filter change is applied to both charts.
Possible Cause
In the initializeTimeline method, existing child nodes of the .timeline container are not fully removed before appending new SVG elements. This leaves old charts in place while rendering new ones.
Suggested Fix
Replace the existing logic for clearing child nodes in the initializeTimeline method with the following:
d3.select(rootElement).selectAll('*').remove();
This ensures that all elements within the .timeline container are removed before the new chart is rendered.
Environment
Streaming Monitor: v 3.16
Browser: Chrome 131.0.6778.265, also reproduced in Edge 132.0.2957.115
