import { ChartConfig } from 'components/interfaces/SQLEditor/UtilityPanel/ChartConfig' // Add helper function for cumulative results export const getCumulativeResults = (results: { rows: any[] }, config: ChartConfig) => { if (!results?.rows?.length) { return [] } const cumulativeResults = results.rows.reduce((acc, row) => { const prev = acc[acc.length - 1] || {} const next = { ...row, [config.yKey]: (prev[config.yKey] || 0) + row[config.yKey], } return [...acc, next] }, []) return cumulativeResults }