-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAM - fix floater overlay order #217
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Try this, for getting rid of diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/BarplotVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/BarplotVisualization.tsx
index c500566bd..87148667a 100755
--- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/BarplotVisualization.tsx
+++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/BarplotVisualization.tsx
@@ -53,7 +53,7 @@ import {
nonUniqueWarning,
hasIncompleteCases,
assertValidInputVariables,
- substituteUnselectedToken1,
+ substituteUnselectedToken,
} from '../../../utils/visualization';
import { VariablesByInputName } from '../../../utils/data-element-constraints';
// use lodash instead of Math.min/max
@@ -468,7 +468,7 @@ function BarplotViz(props: VisualizationProps<Options>) {
);
return grayOutLastSeries(
- substituteUnselectedToken1(
+ substituteUnselectedToken(
reorderData(
barplotResponseToData(
response,
diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/BoxplotVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/BoxplotVisualization.tsx
index 97afc036d..ac514f1b6 100755
--- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/BoxplotVisualization.tsx
+++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/BoxplotVisualization.tsx
@@ -61,7 +61,7 @@ import {
fixVarIdLabel,
getVariableLabel,
assertValidInputVariables,
- substituteUnselectedToken1,
+ substituteUnselectedToken,
} from '../../../utils/visualization';
import { VariablesByInputName } from '../../../utils/data-element-constraints';
import { StudyEntity, Variable } from '../../../types/study';
@@ -537,7 +537,7 @@ function BoxplotViz(props: VisualizationProps<Options>) {
facetVariable
);
return grayOutLastSeries(
- substituteUnselectedToken1(
+ substituteUnselectedToken(
reorderData(
boxplotResponseToData(
response,
diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/HistogramVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/HistogramVisualization.tsx
index f92b34cb3..e473228da 100755
--- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/HistogramVisualization.tsx
+++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/HistogramVisualization.tsx
@@ -64,7 +64,7 @@ import {
variablesAreUnique,
nonUniqueWarning,
assertValidInputVariables,
- substituteUnselectedToken1,
+ substituteUnselectedToken,
} from '../../../utils/visualization';
import { useUpdateThumbnailEffect } from '../../../hooks/thumbnails';
// import variable's metadata-based independent axis range utils
@@ -536,7 +536,7 @@ function HistogramViz(props: VisualizationProps<Options>) {
facetVariable
);
return grayOutLastSeries(
- substituteUnselectedToken1(
+ substituteUnselectedToken(
reorderData(
histogramResponseToData(
response,
diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/LineplotVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/LineplotVisualization.tsx
index b38df9d7d..727315c8f 100755
--- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/LineplotVisualization.tsx
+++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/LineplotVisualization.tsx
@@ -85,7 +85,7 @@ import {
vocabularyWithMissingData,
hasIncompleteCases,
assertValidInputVariables,
- substituteUnselectedToken2,
+ substituteUnselectedToken,
} from '../../../utils/visualization';
import { gray } from '../colors';
import {
@@ -1965,7 +1965,7 @@ export function lineplotResponseToData(
})),
};
return {
- dataSetProcess: substituteUnselectedToken2(dataSetProcess!),
+ dataSetProcess: substituteUnselectedToken(dataSetProcess!),
// calculated y axis limits
xMin,
xMinPos,
diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/ScatterplotVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/ScatterplotVisualization.tsx
index 32ae45d18..8d7c1ab61 100755
--- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/ScatterplotVisualization.tsx
+++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/ScatterplotVisualization.tsx
@@ -78,7 +78,7 @@ import {
fixVarIdLabel,
getVariableLabel,
assertValidInputVariables,
- substituteUnselectedToken2,
+ substituteUnselectedToken,
} from '../../../utils/visualization';
import { gray } from '../colors';
import {
@@ -2236,7 +2236,7 @@ export function scatterplotResponseToData(
);
return {
- dataSetProcess: substituteUnselectedToken2(dataSetProcess),
+ dataSetProcess: substituteUnselectedToken(dataSetProcess),
xMin,
xMinPos,
xMax,
diff --git a/packages/libs/eda/src/lib/core/utils/visualization.ts b/packages/libs/eda/src/lib/core/utils/visualization.ts
index 476da4acf..96df39f94 100644
--- a/packages/libs/eda/src/lib/core/utils/visualization.ts
+++ b/packages/libs/eda/src/lib/core/utils/visualization.ts
@@ -80,39 +80,21 @@ type NamedSeries = {
}[];
};
-// boxplot, barplot, histogram
-export function substituteUnselectedToken1<T extends NamedSeries>(
+export function substituteUnselectedToken<T extends NamedSeries>(
data: T | MaybeFacetedSeriesWithStatistics<T>
-): T | MaybeFacetedSeriesWithStatistics<T> {
- if (isFaceted(data)) {
- return {
- ...data,
- facets: data.facets.map((facet) => ({
- ...facet,
- data: substituteUnselectedToken1(data) as T,
- })),
- };
- } else {
- return {
- ...data,
- series: data.series.map((s) => ({
- ...s,
- name: s.name === UNSELECTED_TOKEN ? UNSELECTED_DISPLAY_TEXT : s.name,
- })),
- };
- }
-}
-
-// lineplot, scatterplot
-export function substituteUnselectedToken2<T extends NamedSeries>(
+): T | MaybeFacetedSeriesWithStatistics<T>
+export function substituteUnselectedToken<T extends NamedSeries>(
data: T | FacetedData<T>
-): T | FacetedData<T> {
+): T | FacetedData<T>
+export function substituteUnselectedToken<T extends NamedSeries>(
+ data: T | FacetedData<T> | MaybeFacetedSeriesWithStatistics<T>
+): T | FacetedData<T> | MaybeFacetedSeriesWithStatistics<T> {
if (isFaceted(data)) {
return {
...data,
facets: data.facets.map((facet) => ({
...facet,
- data: substituteUnselectedToken2(data) as T,
+ data: substituteUnselectedToken(data) as T,
})),
};
} else { |
Thanks @dmfalke and also for the two-parameter generic that solves it without overloads! |
dmfalke
approved these changes
May 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #218
Also moved the
__UNSELECTED__
token stuff to a more central locationTested for categorical and continuous.
Continuous doesn't work yet for scatterplot - the back end response may be malformed. See VEuPathDB/EdaDataService#285