Skip to content

BarVisualAttributes

Inherits: VisualAttributes
Namespace: TauPlot

Data-oriented per-sample style overrides for BAR overlays.

Description

BarVisualAttributes is the BAR specific subclass of VisualAttributes. It carries the two buffers inherited from that base class, color_buffer and alpha_buffer, and adds no overlay-specific buffers of its own.

Assign an instance to TauXYSeriesBinding.visual_attributes when the binding targets a BAR overlay. Any other subclass on such a binding is a validation error and TauPlot.plot_xy() aborts. The plot reads the buffers on each draw pass and applies the per-sample values on top of the per-series color and alpha resolved from TauXYStyle.

Each buffer is optional. A null buffer means no per-sample override for that property, and the resolved style value applies to every sample of the series. Partial buffers are supported: a sample index past the end of the buffer takes the resolved style value as well.

The two buffers reach the fill of a bar. Its shape comes from TauBarStyle.style_box, which only BarVisualCallbacks.style_box_callback overrides per sample.

See TauPaneOverlayConfig for the order a buffer resolves in against a BarVisualCallbacks callback and the style property.

Example

# Color each bar individually by building a per-sample ColorBuffer.
var series_capacity := dataset.get_series_capacity(series_id)
var colors := TauPlot.ColorBuffer.new(series_capacity)
for i in series_capacity:
    colors.append_value(Color(0.2 + i * 0.1, 0.4, 0.8))

var attributes := TauPlot.BarVisualAttributes.new()
attributes.color_buffer = colors

var binding := TauXYSeriesBinding.new()
binding.pane_index = 0
binding.series_id = series_id
binding.overlay_type = TauXYSeriesBinding.PaneOverlayType.BAR
binding.y_axis_id = TauPlot.AxisId.LEFT
binding.visual_attributes = attributes

Constructor

new()

BarVisualAttributes.new() -> BarVisualAttributes

Creates a new BarVisualAttributes instance with all buffers set to null.