Taucharts plugins are plain objects that implement a small set of lifecycle methods. When you pass a plugin in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TargetProcess/tauCharts/llms.txt
Use this file to discover all available pages before exploring further.
plugins array of your chart config, Taucharts calls those methods at well-defined points during initialization and rendering. This architecture lets you add custom UI, intercept and modify the chart spec, subscribe to pointer events, and clean up resources when the chart is destroyed — all without touching Taucharts internals.
The PluginObject interface
A plugin object can implement any combination of three lifecycle hooks:Registering a plugin
UseTaucharts.api.plugins.add(name, factory) to register a named plugin factory. The factory is a function that accepts a settings object and returns a PluginObject. Once registered, the plugin can be retrieved by name with Taucharts.api.plugins.get(name).
Each plugin name must be unique. Calling
plugins.add with a name that is already registered throws an error.Plugin factory pattern
The recommended pattern is a factory function that closes over the settings parameter and returns a fresh plugin object each time it is called. This ensures each chart instance has its own isolated plugin state.Subscribing to chart events
Insideinit(chart), use chart.on(eventName, callback) to subscribe to chart lifecycle events. The callback receives the chart instance as its first argument and event-specific data as the second.
| Event | Fires when | Second argument |
|---|---|---|
'render' | After the chart finishes rendering | The rendered SVGSVGElement |
'beforerender' | Before the draw phase begins | The rendered SVGSVGElement |
'specready' | The GPL spec has been created and transformed by ApplyRatio and AutoLayout | The live GPLSpec object |
'unitsstructureexpanded' | The unit structure has been fully unfolded and axes extracted | The final GPLSpec object |
Accessing the chart layout
chart.getLayout() returns a PlotLayout object containing references to the HTML elements that make up the chart shell. Use these to inject custom UI such as sidebars, headers, or footers without creating conflicting DOM nodes.
Using PluginsSDK utilities
Taucharts.api.pluginsSDK exposes a set of utilities for working with specs and units inside plugin callbacks.
PluginsSDK.unit(unitRef)
PluginsSDK.unit(unitRef)
Wraps a raw spec unit node in a helper object that provides convenience accessors. Useful when you need to inspect or modify a single unit inside an event callback.
PluginsSDK.spec(specRef)
PluginsSDK.spec(specRef)
Wraps a GPL spec in a helper object for easier traversal and modification.
PluginsSDK.traverseSpec(spec, iterator)
PluginsSDK.traverseSpec(spec, iterator)
Walks every node in the spec unit tree in a depth-first order, calling
iterator(node, parentNode) for each one. Use this to find or modify nodes without writing your own traversal.PluginsSDK.extractFieldsFormatInfo(spec)
PluginsSDK.extractFieldsFormatInfo(spec)
Returns a map of dimension names to format info objects (
{ label, format, nullAlias, tickLabel }). Useful for formatting data values consistently with how the chart already displays them.PluginsSDK.getFieldFormatters(spec, formatters)
PluginsSDK.getFieldFormatters(spec, formatters)
Merges custom formatter definitions with the formatters already derived from the spec. Accepts the same formatter shape used by the tooltip and crosshair plugins.
PluginsSDK.depthFirstSearch(node, predicate)
PluginsSDK.depthFirstSearch(node, predicate)
Searches the unit tree starting from
node, returning the first node for which predicate returns true.