[Dashboards] - Min Max range on secondary axis bar charts (#15118)

video QA


https://github.com/user-attachments/assets/70c37188-2398-43de-bbf6-5882bb79940a

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
nitin
2025-10-22 14:21:01 +05:30
committed by GitHub
parent c6addc2bb4
commit 226cc9eb74
37 changed files with 1096 additions and 407 deletions
@@ -0,0 +1,35 @@
import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration';
import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds';
import { isDefined } from 'twenty-shared/utils';
export const isMinMaxRangeValid = (
settingId:
| CHART_CONFIGURATION_SETTING_IDS.MIN_RANGE
| CHART_CONFIGURATION_SETTING_IDS.MAX_RANGE,
newValue: number,
configuration: ChartConfiguration,
): boolean => {
if (!('rangeMax' in configuration || 'rangeMin' in configuration)) {
return false;
}
if (settingId === CHART_CONFIGURATION_SETTING_IDS.MIN_RANGE) {
if (
isDefined(configuration.rangeMax) &&
newValue > configuration.rangeMax
) {
return false;
}
}
if (settingId === CHART_CONFIGURATION_SETTING_IDS.MAX_RANGE) {
if (
isDefined(configuration.rangeMin) &&
newValue < configuration.rangeMin
) {
return false;
}
}
return true;
};