VisualAttributes¶
Inherits: RefCounted
Inherited By: BarVisualAttributes, ScatterVisualAttributes, LineVisualAttributes
Namespace: TauPlot
Abstract class for data-oriented per-sample style overrides.
Description¶
VisualAttributes carries one buffer per overridable property, so a series can hold a distinct value for each of its samples instead of taking one uniform value from its style. VisualAttributes defines the buffers every overlay type has, and each concrete subclass adds the buffers specific to its own overlay type.
An instance is assigned to TauXYSeriesBinding.visual_attributes, and must be the subclass matching the overlay the binding targets: BarVisualAttributes for BAR, ScatterVisualAttributes for SCATTER, and LineVisualAttributes for LINE. Any other type is a validation error and TauPlot.plot_xy() aborts.
A buffer is read by logical sample index, the index the Dataset reads a series by, where 0 is the oldest sample. A series at capacity drops its oldest sample on the next append and every index then names a different sample, so a buffer of a streaming series has to be appended to in step with the data.
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. A buffer does not have to cover the whole series: partial buffers are supported, and a sample index past the end of the buffer takes the resolved style value as well. Entries past the end of the series are never read.
Each buffer also accepts a sentinel entry meaning no override for that one sample, so a buffer can span a whole series and still leave individual samples to the style. Every sentinel is stated on the property that accepts it.
See TauPaneOverlayConfig for the order a buffer resolves in against a VisualCallbacks callback and the style property.
An instance is assigned at runtime only. VisualAttributes is a RefCounted and the property holding it is not exported, so buffers cannot be saved in a .tres resource file.
Notes¶
-
Color sentinel value. An entry equal to
ColorBuffer.NO_COLOR, which is fully transparent black, is treated as unset. That sample falls through to the next resolution step, soColorBuffer.NO_COLORis not a usable override color. -
Alpha sentinel value. A negative entry is treated as unset. That sample falls through to the next resolution step, so a fully transparent sample is written as
0.0rather than as a negative value. -
Hover highlighting runs after the override. The highlight can change the color a sample is drawn with while the cursor is over its pane. A buffer entry decides the color a sample starts from, not always the color it ends up drawn in. See
TauHoverConfig.
Properties¶
color_buffer¶
color_buffer: ColorBuffer
Buffer holding the fill color of each sample. Default is null.
An entry overrides the fill color of the sample at the same index, taking priority over TauXYStyle.series_colors. An entry equal to ColorBuffer.NO_COLOR is treated as unset, see note 1.
The alpha channel of an entry is ignored. The alpha of a sample comes from alpha_buffer or from TauXYStyle.series_alphas.
alpha_buffer¶
alpha_buffer: Float32Buffer
Buffer holding the opacity of each sample, replacing the alpha channel of its fill color. Default is null.
An entry overrides the alpha of the sample at the same index, taking priority over TauXYStyle.series_alphas. Valid override values run from 0.0 to 1.0, and an entry above 1.0 is clamped to 1.0 as the sample is drawn. A negative entry is treated as unset, see note 2.
Related Classes¶
TauXYSeriesBindingOwns theVisualAttributesinstance via itsvisual_attributesproperty.BarVisualAttributesSubclass forBARoverlays.ScatterVisualAttributesSubclass forSCATTERoverlays.LineVisualAttributesSubclass forLINEoverlays.VisualCallbacksCompanion base class that computes the same properties at draw time rather than reading them from a buffer. Buffers take priority over callbacks.TauPaneOverlayConfigBase class of the overlay configurations. Defines how a per-sample override resolves against a callback and a style property.ColorBufferRing buffer storingColorvalues, used bycolor_buffer. Declares theNO_COLORsentinel.Float32BufferRing buffer storingfloatvalues (32-bit), used byalpha_buffer.DatasetThe data model. Its logical sample index is the index a buffer is read by.TauXYStyleProvides the per-series color and alpha a sample falls back to.TauHoverConfigControls the highlight, which can change the color a sample is drawn with.TauPlotThe plot node. Reads the buffers of every binding it received on each draw pass.