// SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project export type ChartAggregation = | 'count' | 'sum' | 'average' | 'maximum' | 'minimum' | 'median' | 'stdev' | 'variance' | 'p05' | 'p25' | 'p50' | 'p75' | 'p95' | 'mode' | 'countUnique'; export type ChartAxisField = { name: string; type: string; }; export type ChartAxis = { field: ChartAxisField | null; aggregation: ChartAggregation | string | null; title?: string | null; /** Time binning period for timestamp/date axes: hour | day | week | month | year */ interval?: string | null; }; export type ChartCrossFilter = { enabled: boolean; filterId: string; fieldNames: Record; value: Record; }; export type BaseChartConfig = { id: string; title: string; type: string; dataId: string | null; applyFilters: boolean; /** * When true, the chart stays visible on the map even if the charts panel * control is inactive (similar to a pinned legend). Persisted in saved maps. */ pinned?: boolean; display: { isConfigActive?: boolean; isJsonEditorActive?: boolean; }; crossFilter?: ChartCrossFilter; }; export type DatasetChartConfig = BaseChartConfig & { xAxis?: ChartAxis; yAxis?: ChartAxis; groupBy?: ChartAxis; value?: ChartAxis; axis?: ChartAxis; numGroups?: number; groupOthers?: boolean; /** How bar/series colors are assigned. */ colorBy?: 'none' | 'category' | string; chartDisplay: Record; }; export type LayerChartConfig = BaseChartConfig & { type: 'layerChart'; layerId: string; layerChartType: string; axis?: ChartAxis; xAxis?: ChartAxis; yAxis?: ChartAxis; chartDisplay: { idField?: string | null; numEntries?: number; interval?: string; format?: string; }; }; export type ChartConfig = DatasetChartConfig | LayerChartConfig;