Charts Technical Reference
Charting State
ChartingState
Charting section of Adaptable State, including Initial State.
ChartDefinitions are AG Grid charts (Name + Model). ExternalChartDefinitions are application charts (Name + Data). A layout opens a saved chart by name.
Wrappers around AG Grid Chart Models
ExternalChartDefinition<unknown>[]
Definitions of External Charts
Chart Definition Object
ChartDefinition
An AG Grid chart saved in Adaptable State.
Distinguished from by Model. Name is unique and is how a layout opens the chart.
ChartModel
AG Grid Chart Model
string
Unique name of the chart (used in UI and layout references, like Layout names)
boolean
Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
Charting Options
ChartingOptions
How charts are saved and where they open.
AG Grid chart definitions the user saves are stored in Charting state. These options decide whether that happens automatically, and which element a chart is drawn into.
string
Name shown for AG Grid's own chart window in the container list.
'AG Grid Window'
Elements a saved chart can be drawn into, offered by name when the user opens a chart.
Omit this to open charts only in AG Grid's own window.
Show, hide, delete and preview for charts that are not AG Grid charts.
Required when the chart is drawn by the application. AdapTable calls these instead of opening an AG Grid chart.
boolean | 'all' | string[]
Opens persisted AG Grid charts when AdapTable is ready.
- true or 'all': all charts in Charting.ChartDefinitions
- string[]: chart names to open (matches each definition's Name property)
undefined (no charts opened automatically)
Behaviour for saving Charts: auto, manual (via popup) or none
'none'
Chart Containers
ChartContainer
Describes Location to display an AG Grid Chart
'single' | 'multiple'
Whether 1 or more Charts can be displayed in same location
'single'
HTMLElement | string
Location - can be HTMLElement or CSS Selector
string
Name of Container's Location - used in Dropdowns
Save Chart Behaviour
| Value |
|---|
'auto' |
'manual' |
'none' |
External Charting Options
ExternalChartingOptions
Options for managing External (i.e. non AG Grid) Charts
(context:ExternalChartingContext) => boolean
Needs to be implemented to specify if Chart is opened; used to set Show Button's highlighting
(context:ExternalChartingContext) => void
Called when User deletes a persisted Chart
(context:ExternalChartingContext) => void
Called when User clicks on Hide button next to Chart
(context:ExternalChartingContext) => ExternalChartDefinition
Shows Chart in Settings Panel preview (not saved into State); returned definition will be passed to 'onHideChart' when Preview closes
(context:ExternalChartingContext) => void
Called when User clicks on Show button next to Chart
Each callback receives an ExternalChartingContext:
ExternalChartingContext
Context passed to External Charting Options functions
ExternalChartDefinition<T>
Definition of External Chart
Chart's Container
Custom application Context provided in AdaptableOptions.adaptableContext
Charting API
Hint
- These functions make it easy to save and retrieves charts from Adaptable State
- But in practice this is more likely to be done at run-time but charts can be defined at design time if required
ChartingApi
Charts saved in AdapTable, and external chart definitions. Includes which charts are open.
void
Add new Chart
Add new external chart definition
void
Close Chart definition
Delete external chart definition
void
Edit existing Chart
void
Edit existing external chart definition
ChartDefinition | undefined
Retrieves Chart definition by name
ChartDefinition | undefined
Retrieves Chart definition by uuid
Retrieves all adaptable Chart definitions
Get info about all saved charts, incl. their open state
ChartRef | undefined
The AG Grid chart reference for a chart AdapTable has open.
ChartModel[]
Retrieves current user-generated Charts
ExternalChartDefinition | undefined
An external chart definition looked up by name.
ExternalChartDefinition[]
Retrieves all adaptable external Chart definitions
ChartContainer | null
Retrieve name of container in which Chart is open; returns null if Chart is not open
ChartModel[]
Retrieves persisted Charts from Adaptable State
boolean
Whether AdapTable's Charting functionality is available
void
Saves all current Charts into Adaptable State
void
Make a Chart Editable (i.e. not Read-Only)
void
Make a Chart Read-Only
ChartRef
Opens a Chart Definition
ChartRef | undefined
Displays a Chart; if Chart is already open, 2nd Chart is not opened
ChartRef[]
Displays all persisted Charts
Chart Changed Event
The Chart Changed Event fires whenever there are any modifications to any open Charts.
ChartChangedInfo
The event comprises a single ChartChangedInfo object which lists the currently opened Charts:
ChartChangedInfo
Payload of the ChartChanged event.
Fires when an AdapTable chart is created, opened, closed or deleted.
Extends , so adaptableApi is included.
Every chart definition, with whether that chart is currently displayed.
Custom application Context provided in AdaptableOptions.adaptableContext
This object contains a collection of ChartDisplayedInfo objects which contains details of displayed Charts:
ChartDisplayedInfo
One chart definition and whether it is displayed.
Chart definition this entry describes.
string | null
Name of the configured chart container whose element contains this chart.
Absent when the chart is closed, shown only in the AG Grid chart container, or no chart containers are configured.
boolean
Whether AG Grid currently has this chart open.
chartingOpenState is a ChartingOpenState:
ChartingOpenState
Open-state snapshot included in .
One entry per chart definition, including charts that are closed.
Every chart definition and its current display state.
Event Subscription
Subscribing to the Event is done the same way as with all Adaptable Events:
api.eventApi.on('ChartChanged', (eventInfo: ChartChangedInfo) => {
// do something with the info
});