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:

PropertyDescription
chartingOpenStateDetails of Open Charts
adaptableContextCustom application Context provided in AdaptableOptions.adaptableContext

This object contains a collection of ChartDisplayedInfo objects which contains details of displayed Charts:

PropertyDescription
chartDefinitionDefinition of the Chart
containerNameContainer where Chart is displayed
isOpenWhether 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:

PropertyDescription
ChartDefinitionsWrappers around AG Grid Chart Models
ExternalChartDefinitionsDefinitions of External Charts

Chart Definition Object

A ChartDefinition simply wraps an AG Grid Charting Model:

PropertyDescription
ModelAG Grid Chart Model
NameName of the chart definition
IsReadOnlySets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

Charting Options

PropertyDescriptionDefault
agGridContainerNameName of AG Grid Chart Container'AG Grid Window'
chartContainersLocations to display saved Charts
externalChartingOptionsSet of properties for managing behaviour of external (i.e non AG Grid) charts
saveChartBehaviourBehaviour for saving Charts: auto, manual (via popup) or none'none'

External Charting Options

PropertyDescription
isChartOpenedNeeds to be implemented to specify if Chart is opened; used to set Show Button's highlighting
onDeleteChartCalled when User deletes a persisted Chart
onHideChartCalled when User clicks on Hide button next to Chart
onPreviewChartShows Chart in Settings Panel preview (not saved into State); returned definition will be passed to 'onHideChart' when Preview closes
onShowChartCalled 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:

MethodDescription
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