From d9d64bdc439fa7040a0b70621a370b90273c3b75 Mon Sep 17 00:00:00 2001 From: porink0424 Date: Wed, 20 Nov 2024 17:31:50 +0900 Subject: [PATCH] Fix categorical choice mapping to use value --- tslib/react/src/components/PlotParallelCoordinate.tsx | 2 +- tslib/react/src/components/PlotSlice.tsx | 2 +- tslib/react/src/components/TrialTable.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tslib/react/src/components/PlotParallelCoordinate.tsx b/tslib/react/src/components/PlotParallelCoordinate.tsx index b97fd5472..aced037b6 100644 --- a/tslib/react/src/components/PlotParallelCoordinate.tsx +++ b/tslib/react/src/components/PlotParallelCoordinate.tsx @@ -173,7 +173,7 @@ const plotCoordinate = ( if (s.distribution.type === "CategoricalDistribution") { // categorical const vocabArr: string[] = s.distribution.choices.map( - (c) => c?.toString() ?? "null" + (c) => c?.value ?? "null" ) const tickvals: number[] = vocabArr.map((_, i) => i) return { diff --git a/tslib/react/src/components/PlotSlice.tsx b/tslib/react/src/components/PlotSlice.tsx index 82e569cd7..c6f5407f9 100644 --- a/tslib/react/src/components/PlotSlice.tsx +++ b/tslib/react/src/components/PlotSlice.tsx @@ -268,7 +268,7 @@ const plotSlice = ( } } else { const vocabArr = selectedParamSpace.distribution.choices.map( - (c) => c?.toString() ?? "null" + (c) => c?.value ?? "null" ) const tickvals: number[] = vocabArr.map((_v, i) => i) layout.xaxis = { diff --git a/tslib/react/src/components/TrialTable.tsx b/tslib/react/src/components/TrialTable.tsx index fe148e06b..8afbec82f 100644 --- a/tslib/react/src/components/TrialTable.tsx +++ b/tslib/react/src/components/TrialTable.tsx @@ -78,7 +78,7 @@ export const TrialTable: FC<{ const sortable = s.distribution.type !== "CategoricalDistribution" const filterChoices: (string | null)[] | undefined = s.distribution.type === "CategoricalDistribution" - ? s.distribution.choices.map((c) => c?.toString() ?? "null") + ? s.distribution.choices.map((c) => c?.value ?? "null") : undefined const hasMissingValue = trials.some( (t) => !t.params.some((p) => p.name === s.name)