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
- This example demonstrates how to define Charts and Chart Locations
- 2 Charts are provided in Charts Initial Adaptable State:
Top Frameworks- a Pie ChartIssues and PRs- a 100% stacked Bar Chart
- 2 Chart locations are provided in the
chartContainersproperty of Charting Options:Top Window- appears above the GridBottom Window- appears below the Grid
- Additionally the
agGridContainerNameproperty has been set to 'Over Grid' - which overrides default property of 'AG Grid Window'
Expand to see the 2 Chart Locations provided
- Open Top Frameworks in the
Top Windowchart location - Open Issues and PR's in the
Bottom Windowchart 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-heightordisplay: flex - Without this the charts will agrow inside the Div infinitely
- This example demonstrates how to show multiple charts in the same location:
- The
chartsDisplayproperty in Charting Options has been set to 'multiple' - An
Above GridChart Container has been provided, together with 2 Chart Definitions - The Chart Container has
display: flexto allow multiple Charts to be shown - In the Adaptable Ready Event we use Charting API methods to display the 2 Charts in the Container
- The
Expand to see how the Charts were displayed
Displaying Multiple Charts
agGridContainerName
Default: AG Grid WindowStringchartContainers
saveChartBehaviour
Default: none'auto' | 'manual' | 'none'