ScatterVisualAttributes¶
Inherits: VisualAttributes
Namespace: TauPlot
Data-oriented per-sample style overrides for SCATTER overlays.
Description¶
ScatterVisualAttributes is the SCATTER specific subclass of VisualAttributes. It carries the two buffers inherited from that base class, color_buffer and alpha_buffer, and adds four scatter-specific buffers: size_buffer, shape_buffer, outline_color_buffer, and outline_width_buffer.
Assign an instance to TauXYSeriesBinding.visual_attributes when the binding targets a SCATTER 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 values resolved from TauScatterStyle and 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 of the series. Partial buffers are supported: a sample index past the end of the buffer takes the resolved style value as well.
The emphasized marker takes the hovered-state properties of TauScatterStyle, so size_buffer, outline_color_buffer, and outline_width_buffer shape every marker except that one.
See TauPaneOverlayConfig for the order a buffer resolves in against a ScatterVisualCallbacks callback and the style property.
Example¶
# Size each marker individually by building a per-sample Float32Buffer.
var series_capacity := dataset.get_series_capacity(series_id)
var marker_sizes := TauPlot.Float32Buffer.new(series_capacity)
for i in series_capacity:
marker_sizes.append_value(8.0 + i * 0.5)
var attributes := TauPlot.ScatterVisualAttributes.new()
attributes.size_buffer = marker_sizes
var binding := TauXYSeriesBinding.new()
binding.pane_index = 0
binding.series_id = series_id
binding.overlay_type = TauXYSeriesBinding.PaneOverlayType.SCATTER
binding.y_axis_id = TauPlot.AxisId.LEFT
binding.visual_attributes = attributes
Constructor¶
new()¶
Creates a new ScatterVisualAttributes instance with all buffers set to null.
Properties¶
size_buffer¶
size_buffer: Float32Buffer
Buffer holding the marker size of each sample. Default is null.
An entry overrides the size of the marker at the same index, taking priority over TauScatterStyle.marker_sizes_px. A negative entry is treated as unset. The unit follows the active TauScatterConfig.marker_size_policy: pixels under THEME, X data units under DATA_UNITS, where the drawn size then changes with the X domain.
The resolved pixel size is raised to 1.0, so an entry of 0.0 draws a one pixel marker rather than hiding one. Hide a marker through shape_buffer instead.
Under DATA_UNITS on a categorical X axis there is no data span to convert, and the entry is not read at all: the size comes from TauScatterStyle.marker_sizes_px, with no error and no warning.
shape_buffer¶
shape_buffer: Int32Buffer
Buffer holding the marker shape of each sample. Default is null.
An entry overrides the shape of the marker at the same index, taking priority over TauScatterStyle.marker_shapes. A negative entry is treated as unset. Valid override values are the TauScatterStyle.MarkerShape members as integers, and any other positive entry draws a CIRCLE with no message, since the buffer is read once per sample.
An entry of NONE draws nothing for that sample. A sample that draws nothing is also left out of hover hit testing, so it reports no SampleHit and never appears in a tooltip.
outline_color_buffer¶
outline_color_buffer: ColorBuffer
Buffer holding the color of the outline stroked around each marker. Default is null.
An entry overrides the outline color of the marker at the same index, taking priority over TauScatterStyle.outline_color. An entry equal to ColorBuffer.NO_COLOR is treated as unset, see note 1 on the base class.
The resolved alpha of the sample is applied on top of the entry, so a marker and its outline fade together.
outline_width_buffer¶
outline_width_buffer: Float32Buffer
Buffer holding the thickness in pixels of the outline stroked around each marker. Default is null.
An entry overrides the outline width of the marker at the same index, taking priority over TauScatterStyle.outline_width_px. A negative entry is treated as unset. Valid override values are 0.0 or greater, where 0.0 leaves that marker unoutlined, and the drawn outline never exceeds half the resolved marker size.
Related Classes¶
VisualAttributesBase class. Defines the inheritedcolor_bufferandalpha_buffer, their sentinels, and the partial buffer rule.TauXYSeriesBindingOwns the instance via itsvisual_attributesproperty.ScatterVisualCallbacksCompanion class that computes the same properties at draw time rather than reading them from a buffer. Buffers take priority over callbacks.TauScatterConfigConfigures the overlay the buffers are read for. Itsmarker_size_policydecides the unit of asize_bufferentry.TauScatterStyleProvides the resolved scatter style values the buffers are applied on top of, including the hovered-state properties that win over them.TauPaneOverlayConfigBase class ofTauScatterConfig. Defines how a per-sample override resolves against a callback and a style property.TauAxisConfigConfigures the X axis whose type decides whether aDATA_UNITSsize is converted or discarded.SampleHitReports one hovered sample. A marker hidden throughshape_bufferproduces none.BarVisualAttributesSibling subclass forBARoverlays.LineVisualAttributesSibling subclass forLINEoverlays.Float32BufferRing buffer storingfloatvalues (32-bit), used bysize_bufferandoutline_width_buffer.Int32BufferRing buffer storingintvalues (32-bit), used byshape_buffer.ColorBufferRing buffer storingColorvalues, used byoutline_color_buffer.TauXYStyleProvides the per-series color and alpha a sample falls back to.DatasetThe data model. Its logical sample index is the index a buffer is read by.