Charts: [Line Chart] Add better support for stacked series data
Created by: vovakulikov
Closes https://github.com/sourcegraph/sourcegraph/issues/33349
Background
Before | After |
---|---|
As you can see prior to this PR the line chart had a bad visual and data stacking. If points from two or more series don't share one x-axis coordinate (time) the stacking logic fails and visually we didn't handle this as well, therefore wierd stacked area paths.
In this PR we handle stacking in series data in the right way. If points from two series don't have the same x time coordinate we're trying to find the closest points from the series on the stack and interpolate values to find the base value for the current point.
Test plan
- Make sure that all stories work as they worked before
- Check the performance of the line chart rendering (should be the same or better)
- Check that stacked series work as they should for non-aligned by x-axis points