hide goal line for percentages stack

This commit is contained in:
Nate Kelley 2025-04-11 22:35:31 -06:00
parent 52f7d99c44
commit e75d6cc622
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 28 additions and 2 deletions

View File

@ -486,8 +486,34 @@ const EtcSettings: React.FC<
}) => {
const isScatterChart = selectedChartType === 'scatter';
const isPieChart = selectedChartType === 'pie';
const isLineChart = selectedChartType === 'line';
const isBarChart = selectedChartType === 'bar';
const hasYAxisValues = selectedAxis.y.length > 0;
const showGoalLine = useMemo(() => {
if (isBarChart) {
return barGroupType !== 'percentage-stack' && hasYAxisValues;
}
if (isLineChart) {
return lineGroupType === 'percentage-stack' && hasYAxisValues;
}
return !isScatterChart && !isPieChart && hasYAxisValues;
}, [isScatterChart, isPieChart, isLineChart, isBarChart, hasYAxisValues]);
const showTrendline = useMemo(() => {
if (isBarChart) {
return barGroupType !== 'percentage-stack' && hasYAxisValues;
}
if (isLineChart) {
return lineGroupType === 'percentage-stack' && hasYAxisValues;
}
return !isPieChart && hasYAxisValues;
}, [isScatterChart, isPieChart, isLineChart, isBarChart, hasYAxisValues]);
const ComponentsLoop: {
enabled: boolean;
key: string;
@ -507,7 +533,7 @@ const EtcSettings: React.FC<
)
},
{
enabled: !isScatterChart && !isPieChart && hasYAxisValues,
enabled: showGoalLine,
key: 'goalLine',
Component: (
<EditGoalLine
@ -519,7 +545,7 @@ const EtcSettings: React.FC<
)
},
{
enabled: !isPieChart && hasYAxisValues,
enabled: showTrendline,
key: 'trendline',
Component: (
<EditTrendline