How it works
The range line chart's signature move is one line morphing between shapes. Switching week, month, or year does not erase and redraw - the old polyline bends continuously into the new one. The trick is aligning point counts: resample both datasets to the same number of points (interpolating to add, thinning to remove), then run a 300 to 400-millisecond requestAnimationFrame loop that interpolates every point each frame, rewriting the polyline's points attribute. The area gradient underneath is a polygon sharing the same interpolated points, so floor and line deform as one body with zero mismatch.
A cheaper fallback exists when frame-looping feels heavy: resample both ranges to a fixed count (say 30 points) and transition the points attribute with SMIL or CSS. It is less code, but the motion reads slightly less organic than true per-frame interpolation.
How to use this prompt
For stock prices, temperature, traffic - any series viewed at multiple granularities. Provide the three ranges' sample data and the AI generates resampling plus interpolation. When point counts differ wildly (7 against 365), instruct the AI to resample to a fixed count before transitioning, or the morph collapses into a one-frame blur.
Tips for better results
Cap the morph at 350 milliseconds; past half a second users are waiting, not watching. Fading the old line to 60% opacity as the morph starts adds depth cheaply. Keep the area gradient's baseline fixed and let only the top edge follow the line - anchored floors make the deformation feel stable. Roll the y-axis labels numerically during the switch so scale and shape change together. Finally, connect points with a Catmull-Rom style smooth curve instead of straight segments; the beauty difference during morphing is dramatic.