TauGridLineConfig¶
Inherits: Resource
Selects which grid lines are enabled in a pane and which axes supply their tick positions.
Description¶
Grid lines are straight lines drawn across the pane background at each tick position. They give the reader a visual reference for reading data values without having to trace back to the axis. X grid lines run perpendicular to the X axis. Y grid lines run perpendicular to the Y axis. Both directions support major lines, which align with major ticks, and minor lines, which align with minor ticks and are typically styled thinner and more transparent to stay visually subordinate.
The four flags x_major_enabled, x_minor_enabled, y_major_enabled, and y_minor_enabled control each independently.
TauGridLineConfig is assigned to TauPaneConfig.grid_line. When that property is null, all grid lines in the pane are disabled. Assigning an instance activates the grid line system for that pane and lets individual lines be turned on or off through the four enable flags.
TauGridLineConfig only governs behavior: which lines are drawn and at which positions. Visual properties such as color, stroke width, and dash pattern are set in TauPaneStyle.
The source axis properties control which axis supplies the tick positions used to place grid lines:
x_source_axis_idselects between the primary and secondary X axis. It is only relevant when a secondary X axis is present on the plot. When no secondary X axis exists, the primary X axis is always used regardless of this property.y_source_axis_idselects which Y axis drives the Y grid lines. It is only relevant when the pane has two populated Y axes. When the pane has exactly one Y axis, that axis is always used regardless of this property.
All property changes are visual-only. Every change triggers a redraw but never triggers layout recomputation.
After TauPlot.plot_xy() succeeds, the plot holds a reference to this instance. Mutating a property at runtime is supported, but requires calling TauPlot.queue_refresh() to apply the change.
Example¶
# Enable major Y grid lines driven by the left axis.
var grid := TauGridLineConfig.new()
grid.y_major_enabled = true
grid.y_source_axis_id = TauPlot.AxisId.LEFT
var pane := TauPaneConfig.new()
pane.y_left_axis = TauAxisConfig.new()
pane.overlays = [TauBarConfig.new()]
pane.grid_line = grid
Constructor¶
new()¶
Creates a new TauGridLineConfig with all enable flags set to false and source axes set to their built-in defaults. All grid lines are disabled until at least one enable flag is set to true.
Properties¶
x_source_axis_id¶
x_source_axis_id: AxisId
The X axis whose tick positions drive the X grid lines. Default is BOTTOM.
Set this to the primary X axis (for example BOTTOM) to use primary axis ticks, or to the opposite axis (for example TOP) to use secondary X axis ticks. Ignored when no secondary X axis is present on the plot. Also ignored when both x_major_enabled and x_minor_enabled are false.
y_source_axis_id¶
y_source_axis_id: AxisId
The Y axis whose tick positions drive the Y grid lines. Default is LEFT.
Only applies when the pane has two populated Y axes. When exactly one Y axis is populated, that axis is used regardless of this property. Also ignored when both y_major_enabled and y_minor_enabled are false.
x_major_enabled¶
x_major_enabled: bool
If true, major grid lines are drawn perpendicular to the X axis at each major tick position. Default is false.
x_minor_enabled¶
x_minor_enabled: bool
If true, minor grid lines are drawn perpendicular to the X axis at each minor tick position. Default is false.
y_major_enabled¶
y_major_enabled: bool
If true, major grid lines are drawn perpendicular to the Y axis at each major tick position. Default is false.
y_minor_enabled¶
y_minor_enabled: bool
If true, minor grid lines are drawn perpendicular to the Y axis at each minor tick position. Default is false.
Related Classes¶
TauPlotThe plot node. ConsumesTauGridLineConfigduring rendering.TauPaneConfigOwns theTauGridLineConfiginstance via itsgrid_lineproperty.TauPaneStyleControls the visual appearance of grid lines: color, thickness, and dash pattern.TauAxisConfigConfigures the axis that supplies tick positions to the grid lines.TauXYConfigHolds the secondary X axis viasecondary_x_axis, which affectsx_source_axis_idbehavior.