Charts can be customised in a number of ways to suit your applications' requirements.
Overriding Chart Options
The primary mechanism for customising charts is via the following
This callback is invoked once, before the chart is created, with
The params object contains a
type property corresponding to the chart about to be created, along with
ChartOptions that are about to be applied.
There are different available options to configure depending on the type of chart. Please refer to the relevant section below for more details:
- General Chart Customisation (these apply to all chart types)
- Bar/Column Chart Customisation
- Line Chart Customisation
- Scatter/Bubble Chart Customisation
- Area Chart Customisation
- Pie/Doughnut Chart Customisation
Example: Customising Charts
The example below demonstrates:
- Stacked Bar, Grouped Bar and Normalized Bar charts have the legend docked to the
- Stacked Column, Grouped Column and Normalized Column charts have the legend docked to the
- Line charts have the legend docked to the
- Scatter charts have the legend docked to the
- Pie charts have the legend docked to the
- Doughnut charts have the legend docked to the
Saving User Preferences
Chart events can be used to detect and save user-made changes.
Formatting changes made through the Format Panel can be captured using the
ChartOptionsChanged event, and changes
to the data range used to render the chart can be detected using the
ChartRangeSelectionChanged event, which
cellRange object that contains information about the range and will allow you to recreate the chart.
Example: Saving User Preferences
The example below demonstrates how the
ChartOptionsChanged event can be used to save and restore
user chart formatting preferences. Notice the following:
- Saving Options by Chart Type: format changes (via the format panel) are preserved after leaving and
returning to the chart by using the
savedUserPreferenceByChartTypeobject to keep track of user format changes on a per-chart type basis.
- Saving Global Chart Options: changes made to the legend options are applied to all new charts by using
savedLegendUserPreferenceobject to globally keep track of legend preferences.