Skip to content

@crossplot/core ​

Headless cross-filter engine, filter store and dashboard model.

Classes ​

ClassDescription
CrossIndexThe cross-filter index. Synchronous, single-threaded, no DOM: the worker and local engines both wrap one of these.
FilterStoreShared filter state for one dashboard: a map from dimension id to filter. Every change produces a new immutable snapshot with a higher version.

Interfaces ​

InterfaceDescription
AxisInfoDescribes one axis of a dimension's bins.
BinOptionsOptions for bin. Set at most one of step, bins or interval.
BinSpecNumeric binning. Exactly one of step, bins or interval decides the bin width.
CategoryColumnDictionary-encoded categorical column. codes[i] indexes dictionary; -1 means missing.
CategorySpecCategorical dimension: one bin per distinct value.
ChartA live chart returned by Dashboard.chart.
ChartDataEverything a renderer needs to draw one chart.
ChartSpecA chart: what to group by, what to aggregate, and how to draw it. Plain and serializable apart from renderer.
ColumnTableA columnar table: the only shape the engine works with.
CrossIndexOptionsOptions for CrossIndex.
DashboardOne table, one filter store and any number of linked charts.
DashboardOptionsOptions for createDashboard.
DataEngineThe 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.
DatumOne bin of a chart's aggregated data, flattened so renderers can hand it straight to a plotting library.
DimensionInfo-
FilterSnapshotAn immutable view of every filter at one point in time.
FromRowsOptions-
GridFilterRectangle on a grid dimension; each axis is a range or a key set.
GridSpecTwo-dimensional dimension, e.g. for heatmaps.
GroupResultPer-bin aggregate values for one group, plus the row counts behind them.
LngLatOptions-
MountContextPassed to Renderer.mount.
NumberColumnNumeric column. Missing values are NaN. date marks columns that came from Date objects; values are epoch milliseconds.
PortThe subset of Worker / MessagePort / DedicatedWorkerGlobalScope we use.
RangeFilterHalf-open numeric range [lo, hi).
RendererThe contract every renderer implements. View is the chart spec's view object, passed through untouched.
RenderHandleA mounted chart, returned by Renderer.mount.
RowsQueryWhich filtered rows to return from Dashboard.rows.
RowsResultA page of filtered rows.
SetFilterSet of category keys.
SummaryRow counts after the latest update.
UpdateResult-

Type Aliases ​

Type AliasDescription
AggregateSpecWhat to compute per bin. Build one with count, sum or mean.
ChartListenerCalled with a chart's fresh aggregates and its own filter after every update.
Column-
ColumnInput-
ColumnType-
Dimension1DSpecA one-axis dimension.
DimensionInputWhat a chart's dimension accepts: a spec, a bare field name (categorical), or an [x, y] pair.
DimensionSpecAny dimension the engine can index.
FieldOfKeys of a row type that can be used as field names.
FilterA filter on one dimension. A grid dimension also takes a plain RangeFilter or SetFilter, applied to its x axis.
FilterListenerCalled with the new snapshot after every change.
FilterStateEvery filter, keyed by dimension id.
IntentWhat a renderer reports back, in data space. It never touches filters.
RowA row object. Field names are its keys.
TimeIntervalCalendar intervals for binning dates.
ValueA primitive cell value accepted on ingest.

Variables ​

VariableDescription
MAX_DIMENSIONSOne bit per dimension in a Uint32 filter mask.

Functions ​

FunctionDescription
binA binned numeric or date dimension.
categoryA categorical dimension with one bin per distinct value.
connectEngineTalk to a served engine through a port (a Worker, or one end of a MessageChannel).
countCount the rows in each bin. The default aggregate.
createDashboardCreate a dashboard: one table, one filter store, any number of linked charts. Each chart aggregates the rows that pass every filter except its own.
fromColumnsBuild a table from column arrays. Typed arrays become numeric columns, arrays are inferred like fromRows.
fromRowsConvert row objects to a column table, once, up front.
lngLatA 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.
localEngineRuns the engine on the calling thread. Good for tests, server-side use and small tables; the dashboard picks the worker engine when it can.
meanAverage a numeric field over the rows in each bin, ignoring missing values.
serveEngineServe a CrossIndex over a port. Call this inside the worker.
sumSum a numeric field over the rows in each bin. Missing values count as zero.
topA categorical dimension that keeps the n most frequent values and groups the rest.
workerEngineRun 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.

Released under the MIT License.