VisualAttributes¶
Inherits: RefCounted
Inherited By: BarVisualAttributes, ScatterVisualAttributes
Namespace: TauPlot
Abstract class for data-oriented per-sample style overrides.
Description¶
VisualAttributes provides a data-oriented way to override style properties per sample. Instead of applying a uniform style to every sample in a series, an overlay can carry a VisualAttributes instance whose buffers supply a distinct value for each sample index. VisualAttributes defines the buffers shared by all overlay types. Concrete subclasses extend it with overlay-specific buffers.
An instance is assigned to TauXYSeriesBinding.visual_attributes. The renderer reads it during each draw pass.
Each buffer is optional. A null buffer means no per-sample override for that property. The resolved style value applies to every sample in the series instead.
A buffer does not need to cover every sample in the series. For any sample index past the end of the buffer, the resolved style value applies. Partial buffers are fully supported.
Fill color values in color_buffer take priority over TauXYStyle.series_colors. Alpha values in alpha_buffer take priority over TauXYStyle.series_alpha.
Notes¶
-
Color sentinel value. An entry equal to
Color(0, 0, 0, 0)incolor_bufferis treated as unset. That sample falls through to the next resolution step: the callback if one is set, thenTauXYStyle.series_colors.Color(0, 0, 0, 0)is therefore not a valid override color. -
Alpha sentinel value. A negative entry in
alpha_bufferis treated as unset. That sample falls through to the resolvedTauXYStyle.series_alphavalue. Valid override values are in the range[0.0, 1.0].
Properties¶
color_buffer¶
color_buffer: ColorBuffer
The per-sample fill color buffer. Default is null.
If null, the fill color for every sample comes from TauXYStyle.series_colors. If set, each entry overrides the fill color of the sample at the same index. An entry equal to Color(0, 0, 0, 0) is treated as unset and falls through to the next resolution step (see note 1). Entries beyond the series length are ignored. Samples beyond the buffer length fall through to the resolved style color.
The alpha channel of any color stored in this buffer is always ignored. The final alpha is determined solely by alpha_buffer or TauXYStyle.series_alpha.
alpha_buffer¶
alpha_buffer: Float32Buffer
The per-sample alpha buffer. Default is null.
If null, the alpha for every sample comes from TauXYStyle.series_alpha. If set, each entry overrides the alpha of the sample at the same index. A negative entry is treated as unset and falls through to the resolved style alpha (see note 2). Entries beyond the series length are ignored. Samples beyond the buffer length fall through to the resolved style alpha.
The resolved alpha overwrites the alpha channel of the fill color, regardless of whether the fill color comes from color_buffer or TauXYStyle.series_colors.
Related Classes¶
TauXYSeriesBindingOwns theVisualAttributesinstance via itsvisual_attributesproperty.BarVisualAttributesSubclass for bar overlays.ScatterVisualAttributesSubclass for scatter overlays.VisualCallbacksCompanion base class that computes the same properties on-the-fly from a callback rather than a buffer.ColorBufferRing buffer storingColorvalues, used bycolor_buffer.Float32BufferRing buffer storingfloatvalues (32-bit), used byalpha_buffer.TauXYStyleProvides the resolved series colors and alpha that buffers override.