Charts Technical Reference
Summary
- The Chart Changed Event fires when Charting State changes
- Charting Initial Adaptable State contains chart definitions saved into AdapTable State
- Charting API contains chart-related functions
- Charting Options contains charting properties
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:
| Property | Description |
|---|---|
| chartingOpenState | Details of Open Charts |
| adaptableContext | Custom application Context provided in AdaptableOptions.adaptableContext |
This object contains a collection of ChartDisplayedInfo objects which contains details of displayed Charts:
| Property | Description |
|---|---|
| chartDefinition | Definition of the Chart |
| containerName | Container where Chart is displayed |
| isOpen | Whether Chart is Open |
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
});Charting State
The Chart section of Adaptable State contains a single ChartDefinitions collection:
| Property | Description |
|---|---|
| ChartDefinitions | Wrappers around AG Grid Chart Models |
| ExternalChartDefinitions | Definitions of External Charts |
Chart Definition Object
A ChartDefinition simply wraps an AG Grid Charting Model:
| Property | Description |
|---|---|
| Model | AG Grid Chart Model |
| Name | Name of the chart definition |
| IsReadOnly | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full') |
Charting Options
| Property | Description | Default |
|---|---|---|
| agGridContainerName | Name of AG Grid Chart Container | 'AG Grid Window' |
| chartContainers | Locations to display saved Charts | |
| externalChartingOptions | Set of properties for managing behaviour of external (i.e non AG Grid) charts | |
| saveChartBehaviour | Behaviour for saving Charts: auto, manual (via popup) or none | 'none' |
External Charting Options
| Property | Description |
|---|---|
| isChartOpened | Needs to be implemented to specify if Chart is opened; used to set Show Button's highlighting |
| onDeleteChart | Called when User deletes a persisted Chart |
| onHideChart | Called when User clicks on Hide button next to Chart |
| onPreviewChart | Shows Chart in Settings Panel preview (not saved into State); returned definition will be passed to 'onHideChart' when Preview closes |
| onShowChart | Called when User clicks on Show button next to Chart |
Charting API
The Charting API section of AdapTable API includes a small number of chart-related functions.
These make it easy to save and retrieves charts from Adaptable State.
Hint
In practice this is more likely to be done at run-time but charts can be defined at design time if required
Charting API includes these functions:
| Method | Description |
|---|---|
| addChartDefinition(chartDefinition) | Add new Chart |
| addExternalChartDefinition(chartDef, options) | Add new external chart definition |
| closeChartDefinition(chartDefinition) | Close Chart definition |
| deleteExternalChartDefinition(chartDefinition) | Delete external chart definition |
| editChartDefinition(chartDefinition) | Edit existing Chart |
| editExternalChartDefinition(chartDef) | Edit existing external chart definition |
| getChartDefinitionByName(name) | Retrieves Chart definition by name |
| getChartDefinitionByUuid(uuid) | Retrieves Chart definition by uuid |
| getChartDefinitions() | Retrieves all adaptable Chart definitions |
| getChartingOpenState() | Get info about all saved charts, incl. their open state |
| getChartRef(chartId) | Retrieves AG Grid ChartRef for given ChartId |
| getCurrentChartModels() | Retrieves current user-generated Charts |
| getExternalChartDefinitionByName(name) | Retrieves Chart definition by name |
| getExternalChartDefinitions() | Retrieves all adaptable external Chart definitions |
| getOpenChartContainer(chartDefinition) | Retrieve name of container in which Chart is open; returns null if Chart is not open |
| getPersistedCharts() | Retrieves persisted Charts from Adaptable State |
| isChartingEnabled() | Whether AdapTable's Charting functionality is available |
| saveCurrentCharts() | Saves all current Charts into Adaptable State |
| setChartEditable(chartDefinition) | Make a Chart Editable (i.e. not Read-Only) |
| setChartReadOnly(chartDefinition) | Make a Chart Read-Only |
| showChartDefinition(chartDefinition, container) | Opens a Chart Definition |
| showChartDefinitionOnce(chartDefinition, container) | Displays a Chart; if Chart is already open, 2nd Chart is not opened |
| showPersistedCharts() | Displays all persisted Charts |