Sparkline Options
All sparkline types and interfaces are available from the ag-charts-community
or ag-charts-enterprise
packages.
import { AgSparklineOptions, ... } from 'ag-charts-community'; // or ag-charts-enterprise
Per-type options for sparklines are available
Sparkline Item Styler
Depending on series type, item stylers are either present on the main options object, or as a property of the markers object.
The signature is generally the same for all series types
function itemStyler(params: AgAreaSeriesMarkerItemStylerParams ): AgSeriesMarkerStyle {
const { yValue } = params;
return {
fill: yValue > 0 ? 'green' : 'red'
};
}
- Bar / Column Item Styler: Params | Result
- Line Item Styler: Params | Result
- Area Item Styler: Params | Result
See AG Charts
- Series Markers for more information on marker options.
- Stylers for more information on item stylers.
Sparkline Tooltip Renderer
The tooltip renderer is a function that can be provided to the sparkline options' tooltip object. It is called with the series datum and should return a string to be displayed in the tooltip.
const sparklineOptions: AgSparklineOptions = {
tooltip: {
renderer: (params: AgSeriesTooltipRendererParams<any>): AgTooltipRendererResult => {
return `Value: ${params.datum.value}`;
}
}
};
See AG Charts Tooltips for more information on tooltip options.