The API explorer can be used to gain familiarity with the AG Charts API and see in real-time how different options affect charts. A code snippet showing the use of the API is produced based on the point and click configurations specified in the explorer.
'line' | 'bar' | 'column' | 'area' | 'scatter' | 'histogram' | TAddonTypeany[]trueHTMLElement | nullautoSize config description for information on how the container element affects the chart size (by default). Object'category'truenumber0.2
numberpaddingInner, this value can be between 0 and 1. Default: 0.3
number0.2
Objectbooleannumbernumberstringany[]number'top' | 'bottom'Objectboolean'line' | 'range'trueanyline. [DataValue, DataValue]range. stringnumberstringnumbernumberPixelSize[][6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels. Objectbooleanstring'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringnumberstring'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'inside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideBottomLeft' | 'insideTopRight' | 'insideBottomRight'numbernumberObjectbooleanstring'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringstringFunctionfunction (params: AgAxisCaptionFormatterParams) => string;
interface AgAxisBoundSeries {
key: string;
name: string;
}
interface AgAxisCaptionFormatterParams {
defaultValue: string;
direction: 'x' | 'y';
boundSeries: AgAxisBoundSeries[];
} Formatter to allow dynamic axis title calculation. string[]Objectnumber1string'rgba(195, 195, 195, 1)'Objectboolean'normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''normal'number12string'Verdana, sans-serif'number5string'#000000'number0booleanfalserotation property is specified, it takes precedence. number335booleanfalse, axis labels may collide. numberstringFunctionfunction (params: AgAxisLabelFormatterParams) => string | undefined;
interface AgAxisLabelFormatterParams {
value: any;
index: number;
fractionDigits: number;
formatter: (x: any) => string;
} Function used to render axis labels. If value is a number, fractionDigits will also be provided, which indicates the number of fractional digits used in the step between ticks; for example, a tick step of 0.0005 would have fractionDigits set to 4 Objectstring'rgba(195, 195, 195, 1)'PixelSize[][4, 2][6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels. Object'number'truebooleantruenumbernumberObjectnumbernumberbooleannumber1number6string'rgba(195, 195, 195, 1)'any[]number'left' | 'right'Objectboolean'line' | 'range'trueanyline. [DataValue, DataValue]range. stringnumberstringnumbernumberPixelSize[][6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels. Objectbooleanstring'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringnumberstring'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'inside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideBottomLeft' | 'insideTopRight' | 'insideBottomRight'numbernumberObjectbooleanstring'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringstringFunctionfunction (params: AgAxisCaptionFormatterParams) => string;
interface AgAxisBoundSeries {
key: string;
name: string;
}
interface AgAxisCaptionFormatterParams {
defaultValue: string;
direction: 'x' | 'y';
boundSeries: AgAxisBoundSeries[];
} Formatter to allow dynamic axis title calculation. string[]Objectnumber1string'rgba(195, 195, 195, 1)'Objectboolean'normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''normal'number12string'Verdana, sans-serif'number5string'#000000'number0booleanfalserotation property is specified, it takes precedence. number335booleanfalse, axis labels may collide. numberstringFunctionfunction (params: AgAxisLabelFormatterParams) => string | undefined;
interface AgAxisLabelFormatterParams {
value: any;
index: number;
fractionDigits: number;
formatter: (x: any) => string;
} Function used to render axis labels. If value is a number, fractionDigits will also be provided, which indicates the number of fractional digits used in the step between ticks; for example, a tick step of 0.0005 would have fractionDigits set to 4 Objectstring'rgba(195, 195, 195, 1)'PixelSize[][4, 2][6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels. Object'column'booleanfalsebooleanstringnumbergrouped is true. For example, if normalizedTo is set to 100, the column stacks will all be scaled proportionally so that each of their totals is 100. stringtruestringtruestringstringyName will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters. stringstringstringnumber1number1number1PixelSize[][6, 3] means dashes with a length of 6 pixels with gaps between of 3 pixels. number0ObjectbooleanstringnumbernumbernumberObject'inside' | 'outside'Functionfunction (params: AgCartesianSeriesLabelFormatterParams) => string;
interface AgCartesianSeriesLabelFormatterParams {
seriesId: string;
value: number;
} Function used to turn 'yKey' values into text to be displayed by a label. By default the values are simply stringified. boolean'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringstringObjectFunctionfunction (params: AgColumnSeriesTooltipRendererParams) => string | AgTooltipRendererResult;
interface AgColumnSeriesTooltipRendererParams {
stackGroup: string;
xKey: string;
xValue: any;
xName: string;
yKey: string;
yValue: any;
yName: string;
datum: any;
title: string;
color: string;
seriesId: string;
} Function used to create the content for tooltips. booleanbooleanshowArrow to true. To remove the arrow, set showArrow to false. Object'pointer' | 'node'truenumbernumberObjectbooleantrueFunctionfunction (params: AgColumnSeriesFormatterParams<DatumType>) => AgColumnSeriesFormat;
interface AgColumnSeriesFormat {
fill: string;
stroke: string;
strokeWidth: number;
}
interface AgColumnSeriesFormatterParams<DatumType> {
datum: DatumType;
fill: string;
stroke: string;
strokeWidth: number;
highlighted: boolean;
xKey: string;
yKey: string;
seriesId: string;
stackGroup: string;
} Function used to return formatting for individual columns, based on the given parameters. If the current column is highlighted, the highlighted property will be set to true; make sure to check this if you want to differentiate between the highlighted and un-highlighted states. ObjectFunctionfunction (params: AgSeriesNodeClickParams<DatumType>) => void;
interface AgSeriesNodeClickParams<DatumType> {
type: 'nodeClick';
seriesId: string;
datum: DatumType;
xKey: string;
yKey: string;
sizeKey: string;
labelKey: string;
colorKey: string;
angleKey: string;
calloutLabelKey: string;
sectorLabelKey: string;
radiusKey: string;
} The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is clicked. Functionfunction (params: AgSeriesNodeClickParams<DatumType>) => void;
interface AgSeriesNodeClickParams<DatumType> {
type: 'nodeClick';
seriesId: string;
datum: DatumType;
xKey: string;
yKey: string;
sizeKey: string;
labelKey: string;
colorKey: string;
angleKey: string;
calloutLabelKey: string;
sectorLabelKey: string;
radiusKey: string;
} The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is double clicked. stringseriesId in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique id value. Default: auto-generated value
DatumType[]booleanbooleanstringcursor property. ObjectObjectstringundefined for no highlight. numberstringundefined for no highlight. numberundefined for no highlight. pxObjectbooleannumberundefined or 1 for no dimming. numberundefined for no highlight. pxPixelSize | 'exact' | 'nearest'Objectboolean'top' | 'right' | 'bottom' | 'left''bottom''horizontal' | 'vertical'numbernumbernumber20ObjectObjectnumber15'circle' | 'cross' | 'diamond' | 'heart' | 'plus' | 'triangle' | any'square''square' if there is none. number8number1Objectnumberstring'black''normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''normal'number12string'Verdana, sans-serif'Functionfunction (params: AgChartLegendLabelFormatterParams) => string;
interface AgChartLegendLabelFormatterParams {
seriesId: string;
itemId: any;
value: string;
} Function used to render legend labels. Where id is a series ID, itemId is component ID within a series, such as a field name or an item index. numbernumber16number8booleanfalse to turn off toggling of the series visibility in the chart when the legend item is clicked. booleantrue. ObjectFunctionfunction (event: AgChartLegendClickEvent) => void;
interface AgChartLegendClickEvent {
type: T;
seriesId: string;
itemId: string;
enabled: boolean;
} The listener to call when a legend item is clicked. Functionfunction (event: AgChartLegendDoubleClickEvent) => void;
interface AgChartLegendDoubleClickEvent {
type: T;
seriesId: string;
itemId: string;
enabled: boolean;
} The listener to call when a legend item is double clicked. ObjectObjectnumber'circle' | 'cross' | 'diamond' | 'heart' | 'plus' | 'triangle' | any'triangle' marker shape. numberObjectstringnumberstringnumbernumberObjectstringnumberstringnumbernumberObjectstringnumberstringnumbernumberObjectstring'normal' | 'italic' | 'oblique''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'numberstringnumbernumberbooleantruefalse to disable this behaviour. If width or height are specified, auto-sizing will be active for the other unspecified dimension.true, make sure to give the chart's container element an explicit size, otherwise you will run into a chicken and egg situation where the container expects to size itself according to the content and the chart expects to size itself according to the container. Objectnumber20number20number20number20Objectnumber0number0number0number0Objectbooleantruestring'#FFFFFF'Objectbooleanfalsestring'Title''normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''bold'number18string'Verdana, sans-serif'string'#000000'numbernumbernumber'never' | 'always' | 'hyphenate' | 'on-space''hyphenate''always' will always wrap text to fit within the maxWidth. 'hyphenate' is similar to 'always', but inserts a hyphen (-) if forced to wrap in the middle of a word. 'on-space' will only wrap on white space. If there is no possibility to wrap a line on space and satisfy maxWidth, the text will be truncated. 'never' disables text wrapping.
Objectbooleanfalsestring'Subtitle''normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''bold'number18string'Verdana, sans-serif'string'#000000'numbernumbernumber'never' | 'always' | 'hyphenate' | 'on-space''hyphenate''always' will always wrap text to fit within the maxWidth. 'hyphenate' is similar to 'always', but inserts a hyphen (-) if forced to wrap in the middle of a word. 'on-space' will only wrap on white space. If there is no possibility to wrap a line on space and satisfy maxWidth, the text will be truncated. 'never' disables text wrapping.
Objectbooleanfalsestring'Footer''normal' | 'italic' | 'oblique''normal''normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900''bold'number18string'Verdana, sans-serif'string'#000000'numbernumbernumber'never' | 'always' | 'hyphenate' | 'on-space''hyphenate''always' will always wrap text to fit within the maxWidth. 'hyphenate' is similar to 'always', but inserts a hyphen (-) if forced to wrap in the middle of a word. 'on-space' will only wrap on white space. If there is no possibility to wrap a line on space and satisfy maxWidth, the text will be truncated. 'never' disables text wrapping.
ObjectbooleantruebooleanshowArrow to true. To remove the arrow, set showArrow to false. stringPixelSize | 'exact' | 'nearest''nearest'Object'pointer' | 'node'truenumbernumbernumber0ObjectFunctionfunction (event: AgNodeClickEvent) => any;
interface AgNodeClickEvent {
type: T;
seriesId: string;
datum: any;
xKey: string;
yKey: string;
sizeKey: string;
labelKey: string;
colorKey: string;
angleKey: string;
calloutLabelKey: string;
sectorLabelKey: string;
radiusKey: string;
event: Event;
} The listener to call when a node (marker, column, bar, tile or a pie sector) in any series is clicked. In case a chart has multiple series, the chart's seriesNodeClick event can be used to listen to nodeClick events of all the series at once. Functionfunction (event: AgNodeDoubleClickEvent) => any;
interface AgNodeDoubleClickEvent {
type: T;
seriesId: string;
datum: any;
xKey: string;
yKey: string;
sizeKey: string;
labelKey: string;
colorKey: string;
angleKey: string;
calloutLabelKey: string;
sectorLabelKey: string;
radiusKey: string;
event: Event;
} The listener to call when a node (marker, column, bar, tile or a pie sector) in any series is double clicked. In case a chart has multiple series, the chart's seriesNodeDoubleClick event can be used to listen to nodeDoubleClick events of all the series at once. Functionfunction (event: AgChartClickEvent) => any;
interface AgChartClickEvent {
type: T;
event: Event;
} The listener to call to signify a general click on the chart by the user. Functionfunction (event: AgChartDoubleClickEvent) => any;
interface AgChartDoubleClickEvent {
type: T;
event: Event;
} The listener to call to signify a double click on the chart by the user. Object'tooltip' | 'node'tooltip.range. Set this to 'node' to highlight nodes when within the series[].nodeClickRange. ObjectObjectstring'No data to display'Functionfunction () => string; A function for generating HTML string for overlay content. Objectbooleanfalsenumber30number10number0[0, 1] interval. number1[0, 1] interval. Objectstring'#999999'string'#999999'number1number0.2[0, 1] interval, where 0 is effectively no masking. Objectstring'#f2f2f2'string'#999999'number1number8number16number2number8Objectstring'#f2f2f2'string'#999999'number1number8number16number2number8string | AgChartTheme'ag-default'AgChartTheme instance to customise. const options = {
series: [
{
type: 'column',
xKey: 'month',
yKey: 'revenue',
stacked: true
},
{
type: 'column',
xKey: 'month',
yKey: 'profit',
stacked: true
}
]
};
<AgChartsReact options={options} />