TauXYSeriesBinding¶
Inherits: Resource
Maps one dataset series to a pane, an overlay type, and a Y axis in an XY plot.
Description¶
TauXYSeriesBinding is the connection object between a Dataset series and its visual representation inside the plot. An array of bindings is passed as the third argument to TauPlot.plot_xy(). Each binding specifies which series to render, in which pane, through which overlay, and against which Y axis.
Four properties define the mapping:
series_ididentifies the series in the dataset.pane_indexselects the pane by its position inTauXYConfig.panes.overlay_typeselects the visual layer:BARorSCATTER.y_axis_idselects the Y axis. That axis must be orthogonal to the X axis set inTauXYConfig.x_axis_id, and the corresponding axis slot must be populated in the target pane.
A series can appear in multiple bindings. It may be rendered in different panes or through different overlay types, for example once as bars and once as scatter markers within the same pane. The only constraints are: - The same series cannot be bound to the same overlay type in the same pane more than once. - A series in one pane must reference the same Y axis across all its bindings for that pane.
The optional visual_attributes property enables per-sample style overrides. When set, the renderer reads its buffers on each draw pass to override color, alpha, or overlay-specific properties per sample. The instance must be of the subclass matching the overlay type: BarVisualAttributes for BAR and ScatterVisualAttributes for SCATTER.
All four required properties are validated when plot_xy() is called. Binding errors abort the call without modifying the current plot.
Example¶
# Price series as bars in pane 0, volume series as bars in pane 1.
var sb_price := TauXYSeriesBinding.new()
sb_price.series_id = dataset.get_series_id_by_index(0)
sb_price.pane_index = 0
sb_price.overlay_type = TauXYSeriesBinding.PaneOverlayType.BAR
sb_price.y_axis_id = TauPlot.AxisId.LEFT
var sb_volume := TauXYSeriesBinding.new()
sb_volume.series_id = dataset.get_series_id_by_index(1)
sb_volume.pane_index = 1
sb_volume.overlay_type = TauXYSeriesBinding.PaneOverlayType.BAR
sb_volume.y_axis_id = TauPlot.AxisId.LEFT
%MyPlot.plot_xy(dataset, config, [sb_price, sb_volume])
Constructor¶
new()¶
Creates a new TauXYSeriesBinding with all properties set to their built-in defaults. Assign at least series_id, pane_index, overlay_type, and y_axis_id before passing the instance to TauPlot.plot_xy().
Properties¶
series_id¶
series_id: int
The series ID of the series to render. Default is 0.
Must match a series ID present in the Dataset passed to plot_xy(). Obtain valid IDs from Dataset methods such as get_series_id_by_index(). If the ID does not exist in the dataset, plot_xy() logs an error and aborts.
pane_index¶
pane_index: int
The zero-based index of the target pane within TauXYConfig.panes. Default is 0.
Selects which pane the series is rendered in. If the index is out of range, plot_xy() logs an error and aborts.
overlay_type¶
overlay_type: PaneOverlayType
The overlay type used to render the series. Default is BAR.
The selected overlay type must be present in the target pane's TauPaneConfig.overlays list.
y_axis_id¶
y_axis_id: AxisId
The Y axis this series is plotted against. Default is LEFT.
Must be orthogonal to the X axis position configured by TauXYConfig.x_axis_id. The axis slot selected by this value must also be populated in the target pane. Violation is a validation error.
visual_attributes¶
visual_attributes: VisualAttributes
Optional per-sample style overrides for this series. Default is null.
When null, all samples use the uniform style resolved from the active style resources. When set, the renderer reads the buffers during each draw pass and applies per-sample overrides on top of the resolved style values. The instance must be the subclass corresponding to overlay_type: BarVisualAttributes for BAR, ScatterVisualAttributes for SCATTER. Supplying the wrong subclass is a validation error.
Related Classes¶
TauPlotThe plot node. Accepts bindings as the third argument ofplot_xy().DatasetSource of the series referenced byseries_id.TauXYConfigDefines the pane list thatpane_indexindexes into, and the X axis position that constrainsy_axis_id.TauPaneConfigDefines the Y axis slots and overlay types available in the target pane.VisualAttributesAbstract base class for per-sample style override buffers, assigned tovisual_attributes.BarVisualAttributesRequired subclass ofVisualAttributeswhenoverlay_typeisBAR.ScatterVisualAttributesRequired subclass ofVisualAttributeswhenoverlay_typeisSCATTER.