Skip to content

Commit

Permalink
Fix bugs with axis variable selection
Browse files Browse the repository at this point in the history
  • Loading branch information
JackWilb committed Nov 13, 2024
1 parent f9b18dc commit bc9ad08
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/src/Components/Utilities/TopMenu/AddModeTopMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ function AddModeTopMenu({ chartType, sx }: { chartType: ChartType; sx: React.CSS

// Automatically set the axis values if the chart type has a fixed option
useEffect(() => {
if (!store.configStore.topMenuBarAddMode) {
return;
}
setXDisabled(chartType === 'COST');
setYDisabled(chartType === 'HEATMAP');
setYDisabled(chartType === 'DUMBBELL');

if (chartType === 'DUMBBELL') {
setYAxisSelection('HGB_VALUE');
Expand Down Expand Up @@ -80,8 +83,8 @@ function AddModeTopMenu({ chartType, sx }: { chartType: ChartType; sx: React.CSS
}

store.chartStore.addNewChart(newChart as LayoutElement);
store.configStore.topMenuBarAddMode = false;
resetFields();
store.configStore.topMenuBarAddMode = false;
}
};

Expand All @@ -98,7 +101,7 @@ function AddModeTopMenu({ chartType, sx }: { chartType: ChartType; sx: React.CSS
label="X Axis Values"
onChange={(e) => { setxAxisSelection(e.target.value as xAxisOption); }}
>
{DropdownGenerator(addOptions[chartType].x, chartType === 'COST')}
{DropdownGenerator(addOptions[chartType].x)}
</Select>
</StyledFormControl>
</CenterAlignedDiv>
Expand Down

0 comments on commit bc9ad08

Please sign in to comment.