({
descending,
limit,
offset,
sortCellId,
xCellId,
yCellId,
}: SeriesProps)
| 16 | import type {DataPoint} from '../common/types.ts'; |
| 17 | |
| 18 | export const useSeriesData = ({ |
| 19 | descending, |
| 20 | limit, |
| 21 | offset, |
| 22 | sortCellId, |
| 23 | xCellId, |
| 24 | yCellId, |
| 25 | }: SeriesProps): readonly [Id, DataPoint[]] => { |
| 26 | const [, rerender] = useState<[]>(); |
| 27 | const context = useCartesianChartContext(); |
| 28 | const { |
| 29 | getSeriesId, |
| 30 | queries, |
| 31 | queriesOrQueriesId, |
| 32 | queryId, |
| 33 | releaseSeriesId, |
| 34 | sourceType, |
| 35 | store, |
| 36 | storeOrStoreId, |
| 37 | tableId, |
| 38 | } = context; |
| 39 | const [seriesId] = useState(getSeriesId); |
| 40 | const handleChange = useCallback(() => rerender([]), [rerender]); |
| 41 | const tableRowIds = useSortedRowIds( |
| 42 | tableId ?? EMPTY_STRING, |
| 43 | sortCellId ?? xCellId, |
| 44 | descending, |
| 45 | offset, |
| 46 | limit, |
| 47 | storeOrStoreId, |
| 48 | ); |
| 49 | const queryRowIds = useResultSortedRowIds( |
| 50 | queryId ?? EMPTY_STRING, |
| 51 | sortCellId ?? xCellId, |
| 52 | descending, |
| 53 | offset, |
| 54 | limit, |
| 55 | queriesOrQueriesId, |
| 56 | ); |
| 57 | const rowIds = sourceType == SourceType.Table ? tableRowIds : queryRowIds; |
| 58 | const points = isNullish(yCellId) |
| 59 | ? [] |
| 60 | : getDataPoints(rowIds, (rowId) => |
| 61 | getDataPoint( |
| 62 | rowId, |
| 63 | getCell(sourceType, store, queries, tableId, queryId, rowId, xCellId), |
| 64 | getCell(sourceType, store, queries, tableId, queryId, rowId, yCellId), |
| 65 | ), |
| 66 | ); |
| 67 | |
| 68 | useCellListener( |
| 69 | sourceType == SourceType.Table ? (tableId ?? null) : null, |
| 70 | null, |
| 71 | xCellId, |
| 72 | handleChange, |
| 73 | [handleChange], |
| 74 | false, |
| 75 | storeOrStoreId, |
no test coverage detected
searching dependent graphs…