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()¶
Creates a new BarVisualAttributes instance with all buffers set to null.
Related Classes¶
VisualAttributesBase class. Defines the inheritedcolor_bufferandalpha_buffer, their sentinels, and the partial buffer rule.TauXYSeriesBindingOwns the instance via itsvisual_attributesproperty.BarVisualCallbacksCompanion class that computes the same properties at draw time rather than reading them from a buffer. Buffers take priority over callbacks.TauBarConfigConfigures the overlay the buffers are read for.TauBarStyleProvides the resolved bar style values the buffers are applied on top of.TauPaneOverlayConfigBase class ofTauBarConfig. Defines how a per-sample override resolves against a callback and a style property.ScatterVisualAttributesSibling subclass forSCATTERoverlays.LineVisualAttributesSibling subclass forLINEoverlays.ColorBufferRing buffer storingColorvalues, used bycolor_buffer.Float32BufferRing buffer storingfloatvalues (32-bit), used byalpha_buffer.TauXYStyleProvides the per-series color and alpha a sample falls back to.DatasetThe data model. Its logical sample index is the index a buffer is read by.