equinor / webviz

Mozilla Public License 2.0
6 stars 6 forks source link

Fix bug when selecting multiple ensembles with same name SimulationTimeSeriesMatrix #341

Closed jorgenherje closed 11 months ago

jorgenherje commented 12 months ago

The plots are built only using ensemble name for labeling, thus two ensembles with same name from two different cases are placed under the same legend tag and with same color in plot.

Use case name + ensemble name for subplot builder?


Suggestions: Propagate a display name i VectorSpec, or retrieve info from Ensemble-object in view before creating plot builder?

anders-kiaer commented 11 months ago

Do we know that "case name + ensemble" is unique? Or can that also be the same for two ensembles (e.g. from different assets)? Should we perhaps include the responsibility of creating unique ensemble display names (and color) to the app global ensemble selector?

HansKallekleiv commented 11 months ago

Case name will not be unique, but case_uuid will.

jorgenherje commented 11 months ago

Good feedback @anders-kiaer and @HansKallekleiv

The idea is to fix up to get a legend per unique ensemble selected. I can create a legendgroup with "ensemble + case uuid", and have a display name e.g: "ensemble + case name"? As of now I do not know if there is a better way to distinguish the selected ensembles in a better way for disaplay - as uuid is not something we want to display?

jorgenherje commented 11 months ago

Todo:

rubenthoms commented 11 months ago

Consider moving complex code out of render return and into a function:

{visualizationMode === VisualizationMode.STATISTICAL_FANCHART ||
(visualizationMode === VisualizationMode.INDIVIDUAL_REALIZATIONS &&
    prevVisualizationMode === VisualizationMode.STATISTICAL_FANCHART)
    ? Object.values(FanchartStatisticOption).map((value: FanchartStatisticOption) => {
            return (
                <Checkbox
                    key={value}
                    label={FanchartStatisticOptionEnumToStringMapping[value]}
                    checked={statisticsSelection?.FanchartStatisticsSelection?.includes(
                        value
                    )}
                    onChange={(event) => {
                        handleFanchartStatisticsSelectionChange(event, value);
                    }}
                />
            );
        })
    : Object.values(StatisticFunction_api).map((value: StatisticFunction_api) => {
            return (
                <Checkbox
                    key={value}
                    label={StatisticFunctionEnumToStringMapping[value]}
                    checked={statisticsSelection?.IndividualStatisticsSelection.includes(
                        value
                    )}
                    onChange={(event) => {
                        handleIndividualStatisticsSelectionChange(event, value);
                    }}
                />
            );
        })}