@crossplot/core
Headless cross-filter engine, filter store and dashboard model.
Classes
| Class | Description |
|---|---|
| CrossIndex | The cross-filter index. Synchronous, single-threaded, no DOM: the worker and local engines both wrap one of these. |
| FilterStore | Shared filter state for one dashboard: a map from dimension id to filter. Every change produces a new immutable snapshot with a higher version. |
Interfaces
| Interface | Description |
|---|---|
| AxisInfo | Describes one axis of a dimension's bins. |
| BinOptions | Options for bin. Set at most one of step, bins or interval. |
| BinSpec | Numeric binning. Exactly one of step, bins or interval decides the bin width. |
| CategoryColumn | Dictionary-encoded categorical column. codes[i] indexes dictionary; -1 means missing. |
| CategorySpec | Categorical dimension: one bin per distinct value. |
| Chart | A live chart returned by Dashboard.chart. |
| ChartData | Everything a renderer needs to draw one chart. |
| ChartSpec | A chart: what to group by, what to aggregate, and how to draw it. Plain and serializable apart from renderer. |
| ColumnTable | A columnar table: the only shape the engine works with. |
| CrossIndexOptions | Options for CrossIndex. |
| Dashboard | One table, one filter store and any number of linked charts. |
| DashboardOptions | Options for createDashboard. |
| DataEngine | The data engine contract. The built-in engines run the same code either on the main thread or in a Web Worker. Everything crossing it is serializable. |
| Datum | One bin of a chart's aggregated data, flattened so renderers can hand it straight to a plotting library. |
| DimensionInfo | - |
| FilterSnapshot | An immutable view of every filter at one point in time. |
| FromRowsOptions | - |
| GridFilter | Rectangle on a grid dimension; each axis is a range or a key set. |
| GridSpec | Two-dimensional dimension, e.g. for heatmaps. |
| GroupResult | Per-bin aggregate values for one group, plus the row counts behind them. |
| LngLatOptions | - |
| MountContext | Passed to Renderer.mount. |
| NumberColumn | Numeric column. Missing values are NaN. date marks columns that came from Date objects; values are epoch milliseconds. |
| Port | The subset of Worker / MessagePort / DedicatedWorkerGlobalScope we use. |
| RangeFilter | Half-open numeric range [lo, hi). |
| Renderer | The contract every renderer implements. View is the chart spec's view object, passed through untouched. |
| RenderHandle | A mounted chart, returned by Renderer.mount. |
| RowsQuery | Which filtered rows to return from Dashboard.rows. |
| RowsResult | A page of filtered rows. |
| SetFilter | Set of category keys. |
| Summary | Row counts after the latest update. |
| UpdateResult | - |
Type Aliases
| Type Alias | Description |
|---|---|
| AggregateSpec | What to compute per bin. Build one with count, sum or mean. |
| ChartListener | Called with a chart's fresh aggregates and its own filter after every update. |
| Column | - |
| ColumnInput | - |
| ColumnType | - |
| Dimension1DSpec | A one-axis dimension. |
| DimensionInput | What a chart's dimension accepts: a spec, a bare field name (categorical), or an [x, y] pair. |
| DimensionSpec | Any dimension the engine can index. |
| FieldOf | Keys of a row type that can be used as field names. |
| Filter | A filter on one dimension. A grid dimension also takes a plain RangeFilter or SetFilter, applied to its x axis. |
| FilterListener | Called with the new snapshot after every change. |
| FilterState | Every filter, keyed by dimension id. |
| Intent | What a renderer reports back, in data space. It never touches filters. |
| Row | A row object. Field names are its keys. |
| TimeInterval | Calendar intervals for binning dates. |
| Value | A primitive cell value accepted on ingest. |
Variables
| Variable | Description |
|---|---|
| MAX_DIMENSIONS | One bit per dimension in a Uint32 filter mask. |
Functions
| Function | Description |
|---|---|
| bin | A binned numeric or date dimension. |
| category | A categorical dimension with one bin per distinct value. |
| connectEngine | Talk to a served engine through a port (a Worker, or one end of a MessageChannel). |
| count | Count the rows in each bin. The default aggregate. |
| createDashboard | Create a dashboard: one table, one filter store, any number of linked charts. Each chart aggregates the rows that pass every filter except its own. |
| fromColumns | Build a table from column arrays. Typed arrays become numeric columns, arrays are inferred like fromRows. |
| fromRows | Convert row objects to a column table, once, up front. |
| lngLat | A world grid of longitude by latitude cells, for maps. Brushing it filters on the raw coordinates, so a box drawn on a plate carrée map is exact. |
| localEngine | Runs the engine on the calling thread. Good for tests, server-side use and small tables; the dashboard picks the worker engine when it can. |
| mean | Average a numeric field over the rows in each bin, ignoring missing values. |
| serveEngine | Serve a CrossIndex over a port. Call this inside the worker. |
| sum | Sum a numeric field over the rows in each bin. Missing values count as zero. |
| top | A categorical dimension that keeps the n most frequent values and groups the rest. |
| workerEngine | Run the engine in a Web Worker. With no argument it starts the worker that ships with this package; bundlers that understand new Worker(new URL(..., import.meta.url)) (Vite, webpack 5, esbuild with a plugin) pick it up automatically. Pass your own Worker to control loading. |