LineVisualAttributes¶
Inherits: VisualAttributes
Namespace: TauPlot
Data-oriented per-sample style overrides for LINE overlays.
Description¶
LineVisualAttributes is the LINE 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 LINE 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 in the series. Partial buffers are supported: for any sample index past the end of the buffer, the resolved style value applies.
The two buffers override the stroke of the curve. The area painted around it takes its color from TauLineFill and is left untouched.
See TauPaneOverlayConfig for the order a buffer resolves in against a LineVisualCallbacks callback and the style property.
Example¶
# Fade the oldest samples of a live series by writing a per-sample alpha.
var capacity := dataset.get_series_capacity(series_id)
var alphas := TauPlot.Float32Buffer.new(capacity)
for i in capacity:
alphas.append_value(float(i + 1) / float(capacity))
var attributes := TauPlot.LineVisualAttributes.new()
attributes.alpha_buffer = alphas
var binding := TauXYSeriesBinding.new()
binding.pane_index = 0
binding.series_id = series_id
binding.overlay_type = TauXYSeriesBinding.PaneOverlayType.LINE
binding.y_axis_id = TauPlot.AxisId.LEFT
binding.visual_attributes = attributes
Notes¶
- A per-sample color colors a sample, not a segment. Each sample carries its own color into the curve, and the segment between two samples fades from the color of one to the color of the other. No interpolation mode makes the change abrupt, since the fade follows the drawn path whatever its shape.
Constructor¶
new()¶
Creates a new LineVisualAttributes instance with all buffers set to null.
Related Classes¶
VisualAttributesBase class. Defines the inheritedcolor_bufferandalpha_buffer.TauXYSeriesBindingOwns the instance via itsvisual_attributesproperty.LineVisualCallbacksCompanion class that computes the same properties from a callback rather than a buffer. Buffers take priority over callbacks.TauLineConfigConfigures the overlay the buffers are read for.TauPaneOverlayConfigBase class ofTauLineConfig. Defines how a per-sample override resolves against a callback and a style property.TauLineStyleProvides the resolved line style values the buffers are applied on top of.TauLineFillPaints the area around the curve, which the buffers do not reach.TauXYStyleProvides the per-series color and alpha a sample falls back to.BarVisualAttributesSibling subclass forBARoverlays.ScatterVisualAttributesSibling subclass forSCATTERoverlays.ColorBufferRing buffer storingColorvalues, used bycolor_buffer.Float32BufferRing buffer storingfloatvalues (32-bit), used byalpha_buffer.DatasetThe data model. Its logical sample index is the index the buffers are read by.