LineVisualCallbacks¶
Inherits: VisualCallbacks
Namespace: TauPlot
Callback-driven per-sample style overrides for LINE overlays.
Description¶
LineVisualCallbacks is the LINE specific subclass of VisualCallbacks. It carries the two callbacks inherited from that base class, color_callback and alpha_callback, and adds no overlay-specific callbacks of its own.
Assign an instance to TauLineConfig.line_visual_callbacks. Any other subclass on a line overlay is a validation error and TauPlot.plot_xy() aborts. The plot invokes each valid callback once per sample on each draw pass and applies the returned values on top of the per-series color and alpha resolved from TauXYStyle.
Each callback is optional. An invalid Callable means no override for that property, and the resolved style value applies to every sample of the series. Each callback receives the dataset series index, the logical sample index, and the X and Y values of the sample, as described in VisualCallbacks.
Both callbacks override the stroke of the curve. The area painted around it takes its color from TauLineFill and is left untouched.
See TauPaneOverlayConfig for the order a callback resolves in against a LineVisualAttributes buffer and the style property.
Example¶
# Color the curve by threshold: samples over the limit read as an alert.
var callbacks := TauPlot.LineVisualCallbacks.new()
callbacks.color_callback = func(series_index: int, sample_index: int, x_value: Variant, y_value: float) -> Color:
return Color.CRIMSON if y_value > 100.0 else Color.STEEL_BLUE
var line_overlay := TauLineConfig.new()
line_overlay.line_visual_callbacks = callbacks
Notes¶
-
A returned color colors a sample, not a segment. Each sample carries its returned color into the curve, and the segment between two samples fades from the color of one to the color of the other. A threshold crossing therefore reads as a fade across the segment rather than as a sharp break at the crossing point, whatever the interpolation mode.
-
y_valueis the value stored in the dataset. InSTACKEDmode the curve is drawn at the running total, and the callback still receives the value theDatasetholds, never the running total and never the normalized value.
Constructor¶
new()¶
Creates a new LineVisualCallbacks instance with all callbacks set to an invalid Callable.
Related Classes¶
VisualCallbacksBase class. Defines the inheritedcolor_callbackandalpha_callback, the arguments every callback receives, and their sentinels.TauLineConfigOwns the instance via itsline_visual_callbacksproperty.LineVisualAttributesCompanion class that overrides the same properties from pre-built buffers rather than callbacks. Buffers take priority over callbacks.TauPaneOverlayConfigBase class ofTauLineConfig. Defines how a per-sample override resolves against a buffer and a style property.TauLineStyleProvides the resolved line style values the callbacks are applied on top of.TauLineFillPaints the area around the curve, which the callbacks do not reach.TauXYStyleProvides the per-series color and alpha a sample falls back to.BarVisualCallbacksSibling subclass forBARoverlays.ScatterVisualCallbacksSibling subclass forSCATTERoverlays.DatasetThe data model. Supplies the sample index and the X and Y values each callback receives.