mirror of https://github.com/buster-so/buster.git
hide goal line for percentages stack
This commit is contained in:
parent
52f7d99c44
commit
e75d6cc622
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue