feat(Chart): Save Chart State globally (#35343)

This commit is contained in:
Alexandru Soare
2025-10-29 15:54:07 +02:00
committed by GitHub
parent 2db19008fb
commit 99b61143f6
36 changed files with 1772 additions and 38 deletions

View File

@@ -82,6 +82,8 @@ export default function TableChart<D extends DataRecord = DataRecord>(
columnColorFormatters,
basicColorFormatters,
width,
onChartStateChange,
chartState,
} = props;
const [searchOptions, setSearchOptions] = useState<SearchOption[]>([]);
@@ -110,6 +112,15 @@ export default function TableChart<D extends DataRecord = DataRecord>(
comparisonColumns?.[0]?.key,
]);
const handleColumnStateChange = useCallback(
agGridState => {
if (onChartStateChange) {
onChartStateChange(agGridState);
}
},
[onChartStateChange],
);
const filteredColumns = useMemo(() => {
if (!isUsingTimeComparison) {
return columns;
@@ -289,6 +300,8 @@ export default function TableChart<D extends DataRecord = DataRecord>(
cleanedTotals={totals || {}}
showTotals={showTotals}
width={width}
onColumnStateChange={handleColumnStateChange}
chartState={chartState}
/>
</StyledChartContainer>
);