• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / deck.gl / 13122626627

03 Feb 2025 08:53PM CUT coverage: 91.635%. Remained the same
13122626627

Pull #9400

github

web-flow
Merge 51c611fab into 276508372
Pull Request #9400: chore(deps): bump github/codeql-action from 2.2.4 to 3.28.8

6690 of 7325 branches covered (91.33%)

Branch coverage included in aggregate %.

54089 of 59002 relevant lines covered (91.67%)

14877.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/modules/aggregation-layers/src/common/aggregator/aggregator.ts
1
// deck.gl
×
2
// SPDX-License-Identifier: MIT
×
3
// Copyright (c) vis.gl contributors
×
4

×
5
import type {Attribute, BinaryAttribute} from '@deck.gl/core';
×
6

×
7
/** Method used to reduce a list of values to one number */
×
8
export type AggregationOperation = 'SUM' | 'MEAN' | 'MIN' | 'MAX' | 'COUNT';
×
9

×
10
/** Baseline inputs to an Aggregator */
×
11
export type AggregationProps = {
×
12
  /** Number of data points */
×
13
  pointCount: number;
×
14
  /** The input data */
×
15
  attributes: {[id: string]: Attribute};
×
16
  /** How to aggregate the values inside a bin, defined for each channel */
×
17
  operations: AggregationOperation[];
×
18
  /** Additional options to control bin sorting, e.g. bin size */
×
19
  binOptions: Record<string, number | number[]>;
×
20
  /** Callback after a channel is updated */
×
21
  onUpdate?: (event: {channel: number}) => void;
×
22
};
×
23

×
24
/** Descriptor of an aggregated bin */
×
25
export type AggregatedBin = {
×
26
  /** The unique identifier of the bin */
×
27
  id: number[];
×
28
  /** Aggregated values by channel */
×
29
  value: number[];
×
30
  /** Count of data points in this bin */
×
31
  count: number;
×
32
  /** Indices of data points in this bin. Only available if using CPU aggregation. */
×
33
  pointIndices?: number[];
×
34
};
×
35

×
36
/**
×
37
 * The Aggregator interface describes a class that performs aggregation.
×
38
 *
×
39
 * _Aggregation_ is a 2-step process:
×
40
 * 1. Sort: Group a collection of _data points_ by some property into _bins_.
×
41
 * 2. Aggregate: for each _bin_, calculate a numeric output (_result_) from some metrics (_values_) from all its members.
×
42
 *    Multiple results can be obtained independently (_channels_).
×
43
 *
×
44
 * An implementation of the _Aggregator_ interface takes the following inputs:
×
45
 * - The number of data points
×
46
 * - The group that each data point belongs to, by mapping each data point to a _binId_ (integer or array of integers)
×
47
 * - The values to aggregate, by mapping each data point in each channel to one _value_ (number)
×
48
 * - The method (_operation_) to reduce a list of values to one number, such as SUM
×
49
 *
×
50
 * And yields the following outputs:
×
51
 * - A list of _binId_ that data points get sorted into
×
52
 * - The aggregated values (_result_) as a list of numbers, comprised of one number per bin per channel
×
53
 * - The [min, max] among all aggregated values (_domain_) for each channel
×
54
 *
×
55
 */
×
56
export interface Aggregator {
×
57
  /** Update aggregation props */
×
58
  setProps(props: Partial<AggregationProps>): void;
×
59

×
60
  /** Flags a channel to need update
×
61
   * @param {number} channel - mark the given channel as dirty. If not provided, all channels will be updated.
×
62
   */
×
63
  setNeedsUpdate(channel?: number): void;
×
64

×
65
  /** Called after props are set and before results are accessed */
×
66
  update(): void;
×
67

×
68
  /** Called before layer is drawn to screen. */
×
69
  preDraw(): void;
×
70

×
71
  /** Dispose all allocated resources */
×
72
  destroy(): void;
×
73

×
74
  /** Get the number of bins */
×
75
  get binCount(): number;
×
76

×
77
  /** Returns an accessor to the bins. */
×
78
  getBins(): BinaryAttribute | null;
×
79

×
80
  /** Returns an accessor to the output for a given channel. */
×
81
  getResult(channel: number): BinaryAttribute | null;
×
82

×
83
  /** Returns the [min, max] of aggregated values for a given channel. */
×
84
  getResultDomain(channel: number): [min: number, max: number];
×
85

×
86
  /** Returns the information for a given bin. */
×
87
  getBin(index: number): AggregatedBin | null;
×
88
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc