Skip to content

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

  1. Color sentinel value. An entry equal to Color(0, 0, 0, 0) in color_buffer is treated as unset. That sample falls through to the next resolution step: the callback if one is set, then TauXYStyle.series_colors. Color(0, 0, 0, 0) is therefore not a valid override color.

  2. Alpha sentinel value. A negative entry in alpha_buffer is treated as unset. That sample falls through to the resolved TauXYStyle.series_alpha value. 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.