From 878e0b8798a3f24929fb8de2536ecd7252360c4e Mon Sep 17 00:00:00 2001 From: Lingyun Zhao <33519183+lingyun1010@users.noreply.github.com> Date: Wed, 25 Oct 2023 11:31:30 +0100 Subject: [PATCH] Fix the tsne plot option dropdown menu label issue (#360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Károly Erdős <2183410+ke4@users.noreply.github.com> --- .../experiment-page/src/TSnePlotViewRoute.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/javascript/bundles/experiment-page/src/TSnePlotViewRoute.js b/app/src/main/javascript/bundles/experiment-page/src/TSnePlotViewRoute.js index 21f982fa1..9d0b4803e 100644 --- a/app/src/main/javascript/bundles/experiment-page/src/TSnePlotViewRoute.js +++ b/app/src/main/javascript/bundles/experiment-page/src/TSnePlotViewRoute.js @@ -104,19 +104,27 @@ class TSnePlotViewRoute extends React.Component { } } plotTypeDropdown={plotTypeDropdown} - selectedPlotOptionLabel={this.state.selectedPlotOptionLabel} + selectedPlotOptionLabel={search.plotOption ? + search.plotType ? + Object.keys(_find(plotTypeDropdown, + (plot) => plot.plotType.toLowerCase() === search.plotType).plotOptions[0])[0] + `: ` + search.plotOption + : + Object.keys(_find(plotTypeDropdown, + (plot) => plot.plotType.toLowerCase() === this.state.selectedPlotType).plotOptions[0])[0] + `: ` + search.plotOption + : + this.state.selectedPlotOptionLabel} onChangePlotTypes={ (plotOption) => { this.setState({ selectedPlotType: plotOption.value, - selectedPlotOption: defaultPlotMethodAndParameterisation[plotOption.value], + selectedPlotOption: Object.values(defaultPlotMethodAndParameterisation[plotOption.value])[0], selectedPlotOptionLabel: Object.keys(defaultPlotMethodAndParameterisation[plotOption.value])[0] + ": " + Object.values(defaultPlotMethodAndParameterisation[plotOption.value])[0], }) const query = new URLSearchParams(history.location.search) query.set(`plotType`, plotOption.value) - query.set(`plotOption`, defaultPlotMethodAndParameterisation[plotOption.value]) + query.set(`plotOption`, Object.values(defaultPlotMethodAndParameterisation[plotOption.value])[0]) resetHighlightClusters(query) updateUrlWithParams(query) }