OrbChartsOrbCharts

TypeScript Types

OrbCharts is written in TypeScript, and its main types are all exported from @orbcharts/core. This page lists them grouped by purpose, with links to the relevant detail pages.

import type { RawData, Encoding, EventData } from '@orbcharts/core'

Data input

The raw data you provide to a chart. For the full format, see Data formats overview.

type RawData = RawDataColumn[] | RawDataColumn[][]
  • RawDataColumn[] is a single dataset; RawDataColumn[][] is multi-dataset (2D).

The fields of RawDataColumn:

FieldTypeDescription
idstringUnique identifier
namestringDisplay name
sourcestringSource node (for graphs)
targetstringTarget node (for graphs)
parentstringParent node (for trees)
dataanyAttached custom data
valuenumber | nullNumeric value
x / y / znumber | nullMultivariate coordinate values
datasetDataset grouping (renamable via Encoding)
seriesSeries grouping (renamable via Encoding)
categoryCategory grouping (renamable via Encoding)

Tip: The first six fields (id, name, source, target, parent, data) are fixed; dataset, series, category, and the like can be mapped to other field names via Encoding.

Configuration types

TypeDescriptionSee
PartialChartOptionsOptions for creating a chart (size, theme, data, encoding, plugins)OrbCharts Class
SizeConfigSize and resize settingsOrbCharts Class
EncodingField mapping, sorting, aggregationEncoding
ThemeColors, light/dark mode, font sizeTheme
ColorsThe palette for a single light/dark modeTheme
ColorTypeThe type Layer params use to point at a Theme colorTheme
PluginEntityThe type of a Plugin instancePlugin API
DeepPartial<T>A deeply optional version of a type, used for updateXxx patches

Data models

The data nodes the chart produces after transforming RawData. The modelType marks which model a datum belongs to:

type ModelType = 'series' | 'grid' | 'multivariate' | 'graph' | 'tree'

Every model node extends ModelDatumBase:

interface ModelDatumBase {
  id:        string
  index:     number
  modelType: ModelType
  name:      string
  data:      any
  value:     number | null
  color:     string
}

Each model adds fields on top of ModelDatumBase:

TypeAdditional fields
ModelDatumSeriesseries, seriesIndex, category, categoryIndex
ModelDatumGridseries, seriesIndex, category, categoryIndex
ModelDatumMultivariateThe above + multivariate: Array<{ index, name, value }>
ModelDatumGraphNodeseries, seriesIndex, category, categoryIndex
ModelDatumGraphEdgeThe above + source, sourceIndex, target, targetIndex
ModelDatumTreeparent: string | null, parentIndex: number | null, depth, seq, children: ModelDatumTree[], series

Event types

TypeDescriptionSee
EventTypeA string union of event kindsEvents
EventData<T>The data object carried by an eventEvents

ChartContext

The type of chart.context, which gathers the chart's RxJS streams and root nodes:

CategoryMembers
Data streamsencoding$, seriesData$, gridData$, multivariateData$, graphData$, treeData$
Config streamsplugins$, theme$, size$
Event streamsevent$, eventTrigger$
Root nodesroot, svg, canvas

The streams are RxJS Observables or Subjects. For event usage, see Events.