Documentation

@kanunilabs/datagrid-enterprise


@kanunilabs/datagrid-enterprise / ChartRenderContext

Interface: ChartRenderContext

Properties

blankLabel

blankLabel: string

What a blank category is called, in the grid's language.


colors

colors: string[]

Per-series colours, already resolved — index-aligned with model.series.


format

format: ChartFormat

The reader's presentation choices. Renderers draw the axis titles and the data labels; the title and the legend are the panel's.


formatAxisLabel?

optional formatAxisLabel?: (request) => string

The app's axis label formatter (charting.axisLabelFormatter, §E.4 #56), ready to call; undefined when there is none. Hand it a tick's raw value and the text you would print, and draw what it returns — a renderer of your own takes part the same way.

Parameters

request

ChartAxisLabelRequest

Returns

string


hidden

hidden: ReadonlySet<number>

Series the user hid via the legend; renderers must skip these.


locale

locale: string

BCP-47 tag for number formatting.


onCategoryClick?

optional onCategoryClick?: (category, index, additive?) => void

Set when cross-filtering is enabled: marks are clickable (draw them with a pointer cursor). The panel handles the clicks itself, through the data-ci attribute a mark carries — the category's index in the model drawn — so a renderer of your own takes part by setting it. additive is a Ctrl/Cmd-click, which adds the category to a selection of several.

While several categories are picked, the panel dims every data-ci mark outside them, so a renderer needs nothing more to show the selection.

Parameters

category

string

index

number

additive?

boolean

Returns

void


rightAxis

rightAxis: ReadonlySet<number>

Series indices that belong on a SECOND, right-hand value axis.

Revenue summed over a million rows is ~2×10⁸; units over the same rows ~2×10⁶ — on one axis the second series is a flat line on the baseline. The panel decides the split; renderers just honour it.


size

size: object

Canvas size in px — REQUIRED here, unlike React's nullable one.

React's null meant "let recharts' ResponsiveContainer measure". These renderers have no container to defer to: the panel measures its canvas and re-renders on resize, so a renderer always knows its box.

height

height: number

width

width: number


stacking

stacking: ChartStacking

Grouped (beside), stacked, or stacked as shares of 100 — offered by the panel for types whose def is stackable. Renderers that cannot stack ignore it; when it is not grouped, rightAxis is empty (one baseline).

Methods

formatColumnValue()

formatColumnValue(columnId, value): string

A raw value of a column as that column prints it — a scatter's x, y and size.

Parameters

columnId

string

value

number

Returns

string


formatSeriesValue()

formatSeriesValue(seriesIndex, value): string

Series i's value as its column prints it (formatChartValue).

Parameters

seriesIndex

number

value

number

Returns

string


formatValue()

formatValue(value): string

Parameters

value

number

Returns

string