JavaScript ChartsCreate/Update
Learn about creating and updating charts in more detail.
AgChart
exposes create()
and update()
static methods to perform chart initialisation and update based upon
the AgChartOptions
configuration structure.
Mutations to the previously used options object are not automatically picked up by the chart implementation,
AgChart.update()
should be called for changes to be applied.
NOTE: We expect the options supplied to AgChart.update()
to be the full configuration state to update
to, not a partial configuration. Use AgChart.updateDelta()
to apply partial updates.
AgChart
has the following API:
See the Options Reference for more detail about the AgChartOptions
structure.
The following example demonstrates both create and update cases:
- Definition of an
options
object used to create the initial chart state. - Buttons that invoke mutations of the
options
and trigger update of the chart state.
AgChart
exposes an updateDelta()
static method to allow partial updates to a charts options.
To assist with state management, the complete applied options state can be retrieved by calling
getOptions()
on the
AgChartInstance
:
| Get the AgChartOptions representing the current chart configuration.
|
The following example demonstrates:
- Retrieving current Chart configuration via
getOptions()
. - Mutation of the Chart configuration via
updateDelta()
.