Description
Describe the issue
Main
When we have a stacked chart (bar, line, or area) and we disable the visibility of some series, the statistics for those series do not display in the legend.

This behavior is inconsistent because we show statistics for invisible series in non-stacked charts.
The root cause is this line in the code: stacked_series_utils.ts#L61, which filters out the series, preventing them from displaying in the legend. We do that because otherwise the series ‘hang’ in the air when painting them because the invisible series are included in the calculations. This is how it looks if I remove the if (isFiltered) return
line:

Instead of this, I tried to sort the series to place invisible series on the top:
const sortedDataSeries = dataSeries.reverse().sort(({ isFiltered }) => (isFiltered ? 1 : -1));
const dataSeriesMap = sortedDataSeries.reduce<Map<SeriesKey, DataSeries>>((acc, curr) => {...
This way they won't impact stacking, but they can still display in the legend. However, it breaks some other cases.

@nickofthyme could you advise? 🙏🏼