@kepler.gl/utils 3.3.0-alpha.21 → 3.3.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ export { default as domtoimage } from './dom-to-image';
8
8
  export { getFrequency, getMode, aggregate } from './aggregation';
9
9
  export { ColumnStatsType, NUMERIC_BIN_COUNT, collectColumnValues, computeColumnStats, getColumnStatistics } from './column-statistics';
10
10
  export type { ColumnStats, NumericColumnStats, CategoricalColumnStats, TimeColumnStats, Quantile } from './column-statistics';
11
- export { adjustValueToAnimationWindow, getBinThresholds, getNumericBinThresholds, getNumericPlotInterval, getNumericRangeMinimum, nextDown, nextUp, getFilterBinThresholds, intervalBinFromMarks, histogramFromThreshold, histogramFromValues, histogramFromDomain, histogramFromOrdinal, histogramFromTimeIntervals, mergePolygonLayerIndexes, runGpuFilterForPlot, updateTimeFilterPlotType, getLineChart, mergePlotGroupBy, lineChartSeriesLegend, defaultPlotGroupColorRange, PLOT_GROUP_OTHERS_NAME, PLOT_NUM_GROUPS_ALL, PLOT_NUM_GROUPS_OPTIONS, DEFAULT_PLOT_NUM_GROUPS, MAX_PLOT_NUM_GROUPS } from './plot';
11
+ export { adjustValueToAnimationWindow, getBinThresholds, getNumericBinThresholds, getNumericPlotInterval, getNumericRangeMinimum, nextDown, nextUp, getFilterBinThresholds, intervalBinFromMarks, histogramFromThreshold, histogramFromValues, histogramFromDomain, histogramFromOrdinal, histogramFromTimeIntervals, mergePolygonLayerIndexes, runGpuFilterForPlot, updateTimeFilterPlotType, getLineChart, getCategoricalHistogram, mergePlotGroupBy, lineChartSeriesLegend, defaultPlotGroupColorRange, PLOT_GROUP_OTHERS_NAME, PLOT_NUM_GROUPS_ALL, PLOT_NUM_GROUPS_OPTIONS, DEFAULT_PLOT_NUM_GROUPS, MAX_PLOT_NUM_GROUPS } from './plot';
12
+ export { getLayerHistogram, isLayerHistogramSupported } from './layer-histogram';
12
13
  export * from './data-utils';
13
14
  export type { FieldFormatter } from './data-utils';
14
15
  export * from './strings';
@@ -0,0 +1,16 @@
1
+ import type { Bins, Field, KeplerLayer } from '@kepler.gl/types';
2
+ type HistogramDatasets = Record<string, {
3
+ fields: Field[];
4
+ }>;
5
+ type LegendItem = {
6
+ name: string;
7
+ color: string;
8
+ };
9
+ /** Whether this layer supplies a discrete, per-row primary color for the selected dataset. */
10
+ export declare function isLayerHistogramSupported(layer: KeplerLayer, dataId: string): boolean;
11
+ /** Count each bin's rows using the source layer's actual discrete color classes. */
12
+ export declare function getLayerHistogram(bins: Bins, datasets: HistogramDatasets, layer: KeplerLayer): {
13
+ bins: Bins;
14
+ legend: LegendItem[];
15
+ } | null;
16
+ export {};
package/dist/plot.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Bin, TimeBins, Millisecond, TimeRangeFilter, RangeFilter, PlotType, PlotGroupBy, Filter, LineChart, Field, ValueOf, ColorRange } from '@kepler.gl/types';
1
+ import { format as d3Format } from 'd3-format';
2
+ import { Bin, Bins, TimeBins, Millisecond, TimeRangeFilter, RangeFilter, PlotType, PlotGroupBy, Filter, LineChart, Field, ValueOf, ColorRange } from '@kepler.gl/types';
2
3
  import { AggregationTypes } from '@kepler.gl/constants';
3
4
  import { DataContainerInterface } from '.';
4
5
  import { KeplerTableModel } from './types';
@@ -104,6 +105,14 @@ export declare function defaultPlotGroupColorRange(numGroups?: number | typeof P
104
105
  * `null` clears grouping. Missing fields keep the previous value, then defaults.
105
106
  */
106
107
  export declare function mergePlotGroupBy(prev: PlotGroupBy | null | undefined, next: Partial<PlotGroupBy> | null | undefined): PlotGroupBy | null;
108
+ /** Split counts by category or numeric range, preserving the original bin totals and indexes. */
109
+ export declare function getCategoricalHistogram(bins: Bins, datasets: Datasets, plotType: Filter['plotType']): {
110
+ bins: Bins;
111
+ legend: {
112
+ name: string;
113
+ color: string;
114
+ }[];
115
+ } | null;
107
116
  export declare function lineChartSeriesLegend(lineChart?: LineChart | null): {
108
117
  name: string;
109
118
  color: string;
@@ -137,6 +146,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
137
146
  view: import("@kepler.gl/types").FilterViewType;
138
147
  isAnimating: boolean;
139
148
  animationWindow?: string;
149
+ animationLoop?: boolean;
140
150
  speed: number;
141
151
  showTimeDisplay?: boolean;
142
152
  name: string[];
@@ -144,7 +154,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
144
154
  fieldIdx: number[];
145
155
  domain: any[] & number[];
146
156
  mappedValue?: number[];
147
- yAxis: Field | null;
157
+ yAxis: d3Format | null;
148
158
  lineChart?: LineChart | undefined;
149
159
  gpu: boolean;
150
160
  gpuChannel?: number[];
@@ -155,7 +165,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
155
165
  endMappedValue?: ((number | null)[] | null | undefined)[];
156
166
  layerId?: string[];
157
167
  step: number;
158
- bins?: import("@kepler.gl/types").Bins;
168
+ bins?: Bins;
159
169
  typeOptions: ["range"];
160
170
  } | {
161
171
  value: any[];
@@ -168,6 +178,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
168
178
  view: import("@kepler.gl/types").FilterViewType;
169
179
  isAnimating: boolean;
170
180
  animationWindow?: string;
181
+ animationLoop?: boolean;
171
182
  speed: number;
172
183
  showTimeDisplay?: boolean;
173
184
  name: string[];
@@ -175,7 +186,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
175
186
  fieldIdx: number[];
176
187
  domain: any[] & number[];
177
188
  mappedValue?: number[];
178
- yAxis: Field | null;
189
+ yAxis: d3Format | null;
179
190
  plotType: {
180
191
  [key: string]: any;
181
192
  } & {
@@ -208,6 +219,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
208
219
  view: import("@kepler.gl/types").FilterViewType;
209
220
  isAnimating: boolean;
210
221
  animationWindow: string;
222
+ animationLoop?: boolean;
211
223
  speed: number;
212
224
  showTimeDisplay?: boolean;
213
225
  name: string[];
@@ -215,7 +227,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
215
227
  fieldIdx: number[];
216
228
  domain: any[] & [number, number];
217
229
  mappedValue: number[] & (number | null)[];
218
- yAxis: Field | null;
230
+ yAxis: d3Format | null;
219
231
  lineChart?: LineChart | undefined;
220
232
  gpu: boolean;
221
233
  gpuChannel?: number[];
@@ -243,6 +255,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
243
255
  view: import("@kepler.gl/types").FilterViewType;
244
256
  isAnimating: boolean;
245
257
  animationWindow: string;
258
+ animationLoop?: boolean;
246
259
  speed: number;
247
260
  showTimeDisplay?: boolean;
248
261
  name: string[];
@@ -250,7 +263,7 @@ export declare function adjustValueToAnimationWindow<S extends MinVisStateForAni
250
263
  fieldIdx: number[];
251
264
  domain: any[] & [number, number];
252
265
  mappedValue: number[] & (number | null)[];
253
- yAxis: Field | null;
266
+ yAxis: d3Format | null;
254
267
  plotType: {
255
268
  [key: string]: any;
256
269
  } & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/utils",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.3.0-alpha.21",
4
+ "version": "3.3.0-alpha.23",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@deck.gl/core": "^9.4.1",
32
- "@kepler.gl/common-utils": "3.3.0-alpha.21",
33
- "@kepler.gl/constants": "3.3.0-alpha.21",
34
- "@kepler.gl/types": "3.3.0-alpha.21",
32
+ "@kepler.gl/common-utils": "3.3.0-alpha.23",
33
+ "@kepler.gl/constants": "3.3.0-alpha.23",
34
+ "@kepler.gl/types": "3.3.0-alpha.23",
35
35
  "@loaders.gl/gis": "^4.4.5",
36
36
  "@luma.gl/constants": "^9.4.2",
37
37
  "@luma.gl/core": "^9.4.2",