Configuring Charts

Summary

  • AG Grid Charts can be defined and saved with AdapTable State
  • Locations can be provided where AG Grid Charts can be displayed

Defining Charts

AdapTable allows developers to define Charts and save them in Adaptable State.

Hint

  • This can be done at design-time and the AG Grid Charting Model can be part of the definition
  • But more typically it will be done via the methods in Charting API

Each Chart Definition contains just 2 properties:

  • Name of the Chart - how it appears in the AdapTable UI
  • Chart Model - the underlying AG Grid Chart definition

Providing Chart Locations

AdapTable also allows developers to provide details Chart Locations.

This is done through the chartContainers property of Charting Options.

Each location contains a Name and a reference to the Div elememnt where Charts can be displayed.

Deep Dive

Understanding Chart Containers

The default Chart Container is the one provided by AG Grid and named 'AG Grid Window' by AdapTable

Hint

Use the agGridContainerName property in Charting Options to provide a different name for this container

Chart Locations
Fork
  • This example demonstrates how to define Charts and Chart Locations
  • 2 Charts are provided in Charts Initial Adaptable State:
    • Top Frameworks - a Pie Chart
    • Issues and PRs - a 100% stacked Bar Chart
  • 2 Chart locations are provided in the chartContainers property of Charting Options:
    • Top Window - appears above the Grid
    • Bottom Window - appears below the Grid
  • Additionally the agGridContainerName property has been set to 'Over Grid' - which overrides default property of 'AG Grid Window'

Expand to see the 2 Chart Locations provided

Try It Out
  • Open Top Frameworks in the Top Window chart location
  • Open Issues and PR's in the Bottom Window chart location

Multiple Charts in a Location

By default AdapTable will display one chart in each provided Location.

This means that loading a new chart will displace any currently displayed Chart.

This behaviour can be changed by setting chartsDisplay in Charting Options to 'multiple'.

When this property is set, charts are appended to the Div.

Caution

  • To place multiple charts in a container, it needs a fixed height - e.g. max-height or display: flex
  • Without this the charts will agrow inside the Div infinitely
Multiple Charts in Location
Fork
  • This example demonstrates how to show multiple charts in the same location:
    • The chartsDisplay property in Charting Options has been set to 'multiple'
    • An Above Grid Chart Container has been provided, together with 2 Chart Definitions
    • The Chart Container has display: flex to allow multiple Charts to be shown
    • In the Adaptable Ready Event we use Charting API methods to display the 2 Charts in the Container

Expand to see how the Charts were displayed

Displaying Multiple Charts

(Recorded with AdapTable v14.0)

agGridContainerName

Default: AG Grid Window
String
Name of AG Grid Chart Container

chartContainers

Locations to display saved Charts

saveChartBehaviour

Default: none
'auto' | 'manual' | 'none'
Behaviour for saving Charts into AdapTable State