Skip to content

Charts: [Line Chart] Add better support for stacked series data

Warren Gifford requested to merge vk/fix-stacked-line-chart into main

Created by: vovakulikov

Closes https://github.com/sourcegraph/sourcegraph/issues/33349

Background

Before After
Screenshot 2022-04-04 at 14 56 38 Screenshot 2022-04-04 at 14 56 54

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.

Screenshot 2022-04-04 at 15 06 02

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

App preview:

Merge request reports

Loading