Skip to content

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

  1. 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()

LineVisualAttributes.new() -> LineVisualAttributes

Creates a new LineVisualAttributes instance with all buffers set to null.