Chart models and extensions
Customize chart rendering, tooltips, and exports.
Define marks and their data
ChartProps<TDatum, TX, TY> accepts a typed TanStack definition. Each mark can use its own dataset. Layer marks in the definition when they belong on the same chart.
Use @tanstack/charts directly for data calculations or output outside React.
Choose SVG or a custom renderer
For SVG, use renderSvg and onRender. For a custom renderer, use renderer and onRendererRender. The custom mode rejects the SVG callbacks. Scope subscriptions to the active renderer and release them when it changes.
Use renderTooltipBody(context) to customize the tooltip. Render context.defaultBody to keep the default content, or return null, undefined, or false to hide it. ChartToolbar provides optional controls. Wire their actions to your app.
Customize data and appearance
Configure data transformations, interaction and renderer capabilities through the native definition. Configure Ghost's presentation policies through the host's props; their defaults and styling belong in the component API. A native feature does not need a renamed Ghost option.
See Chart API for view props and Chart examples for concrete definitions. Use native state/interaction options for linked inspection and selection rather than synchronizing a second Ghost hover store. If a renderer supplies presentation-point subscriptions, Ghost follows those positions; do not infer that every custom renderer supports every appearance enhancement.
Export an image or data file
Export SVG or PNG through the native renderer. For CSV, export the intended dataset with its units and filters. Show export success after the file is ready and surface failures in the app.