studio icon indicating copy to clipboard operation
studio copied to clipboard

Remove dataset iteration for PlotLegendRow

Open defunctzombie opened this issue 2 years ago • 0 comments

PlotLegendRow iterates the dataset to find the "current value" for each series. https://github.com/foxglove/studio/blob/main/packages/studio-base/src/panels/Plot/PlotLegendRow.tsx#L138

This is an expensive operation for large datasets since it happens on every tick. Rather than iterating the dataset, we should provide the current value to the PlotLegendRow from its parent container where we are receiving the value as the data source plays.

For hover values, we should leverage the existing logic that powers the hover tooltip display (which already figures out the value) and also pass that to the PlotLegendRow. The PlotLegendRow should avoid doings its own dataset iteration.

defunctzombie avatar Feb 25 '22 22:02 defunctzombie