@kanunilabs/datagrid-react-enterprise
@kanunilabs/datagrid-react-enterprise / GridChartPanelProps
Interface: GridChartPanelProps<TRow>
Type Parameters
TRow
TRow = GridRowData
Properties
apiRef?
optionalapiRef?:object
Receives update / getState while the panel is mounted, and null
after. The panel also reports on the controller's event bus:
chartOpened on mount, chartChanged, and chartClosed on unmount.
current
current:
GridChartPanelApi|null
axisLabelFormatter?
optionalaxisLabelFormatter?:ChartAxisLabelFormatter
Write the tick labels of both axes yourself (§E.4 #56): called once per
label with the raw value and the text the chart would print — return
params.text to keep the default. Keep it stable (useCallback): a new
function draws the chart again.
chartId?
optionalchartId?:string
Makes this panel one of the grid's extra chart windows (§E.1 #10): it
always floats, its title carries the number, and every event it reports
carries this id as chartId.
columns
columns:
object[]
Columns offered in the pickers, in grid order.
enumerated marks a column that draws from a bounded set (it has a
lookup) — the only reliable signal, without counting a million rows, that
a column makes a sensible category. isKey marks the row key.
enumerated?
optionalenumerated?:boolean
id
id:
string
isKey?
optionalisKey?:boolean
label
label:
string
numeric
numeric:
boolean
role?
optionalrole?:"series"|"category"|"time"
The column's chartRole (§E.1 #12): the panel's first choice for that role.
temporal?
optionaltemporal?:boolean
A date column — offered calendar grouping, and bucketed by default.
controller
controller:
DataGridController<TRow> |null
crossFilter?
optionalcrossFilter?:boolean
Clicking a category filters the grid by it; clicking it again, or the chart's background, clears it. Ctrl/Cmd-click adds a category or takes it out again — the grid then shows the rows of ANY picked category, and the chart keeps every category on screen to pick from. Off by default — see §13.
floatable?
optionalfloatable?:boolean
Offer "Pop out": the panel leaves its place and floats over its parent element, moved by its title bar and resized from its corner (rival analysis, charts §E.1 #9). The grid turns it on; off for a panel placed by the app, whose parent may be no place for a window.
height?
optionalheight?:number
Fixed canvas height in px. Omit to fill the panel.
Filling relies on recharts' ResizeObserver, which never fires for an
element that is display: none — so a chart inside a collapsed accordion
or an inactive tab stays blank until it is shown. A fixed height sidesteps
the observer and draws immediately.
initialFloating?
optionalinitialFloating?:boolean|FrameRect
Open floating — true for a centred window, or a rectangle (px, relative
to the parent). Ignored when initialState says where the panel is.
initialFormat?
optionalinitialFormat?:ChartFormat
Title, axis titles, legend position and data labels to open with. The
panel's Format editor changes them afterwards; onFormatChange reports
each change so an app can keep it (it is plain data).
initialSpec?
optionalinitialSpec?:Partial<ChartSpec<TRow>>
initialStacking?
optionalinitialStacking?:ChartStacking
Series layout to open on: beside each other (grouped, the default), on
top of each other (stacked), or as shares of each category's total
(normalized, 100%). A rendering choice like initialType; the panel's
own picker changes it afterwards, for the types that can stack.
initialState?
optionalinitialState?:Partial<Omit<GridChartState,"version"|"open">>
A chart to open with — any part of GridChartState (a saved state is
one). Each part it carries wins over initialSpec, initialType,
initialStacking and initialFormat; the legend switches and the zoom
window come back too.
initialType?
optionalinitialType?:string
Chart type to open on — a registered renderer's id. Defaults to column.
Separate from initialSpec because the type is a RENDERING choice, not
part of the (serializable, worker-bound) chart definition; the panel's own
picker changes it afterwards either way. The cell menu's chart submenu
uses this to open straight into the type the user picked.
labels?
optionallabels?:Partial<GridChartPanelLabels>
locale?
optionallocale?:string
onFormatChange?
optionalonFormatChange?: (format) =>void
Parameters
format
ChartFormat
Returns
void
onNewWindow?
optionalonNewWindow?: (state,anchor) =>void
Offer "New window": called with this chart's state and, when it floats, its rectangle — the grid opens the copy beside it.
Parameters
state
GridChartState
anchor
FrameRect | null
Returns
void
onSpecChange?
optionalonSpecChange?: (spec) =>void
Parameters
spec
ChartSpec<TRow>
Returns
void
onStateChange?
optionalonStateChange?: (state) =>void
The panel as data, after every change (and once on mount).
Parameters
state
GridChartState
Returns
void
Methods
onClose()
onClose():
void
Returns
void