TauLineStyle¶
Inherits: TauStyle
Controls the visual appearance of line overlays.
Description¶
A line overlay draws one curve per series through its samples, in X order. TauLineStyle controls how those curves look: their width in the normal and in the hovered state, their dash length, and the TauLineFill that paints the area around each of them.
The stroke color of a curve is not a property of this class. It comes from TauXYStyle.series_colors, with its alpha channel replaced by TauXYStyle.series_alphas.
TauLineStyle lives on TauLineConfig.style. It is created with TauLineConfig and is never null. Several TauLineConfig instances can share the same instance.
Every property is a cycle, holding one entry per series. Three of them replace the themed cycle once assigned, the way a cycle normally does. fills is the exception: it merges with the themed cycle field by field, so a fill only has to carry what it changes. See note 3.
Three-layer cascade¶
Each property is resolved in three layers: the built-in default, then the value the active Godot theme names, then the value assigned on this instance. A property counts as overridden as soon as it is assigned, whatever the value, and for an array property only assigning a new array counts.
See TauStyle for the cascade and TauStyle for the grammar of the keys listed in Theming.
Theming¶
TauLineStyle reads its keys from the TauLine theme type variation, whose base type is Control.
A theme resource using TauLine must include a base type declaration:
The following theme entries are used:
| Theme property | Description |
|---|---|
line_width_px_i: int |
Maps to entry i of line_widths_px, in pixels. |
line_hovered_width_px_i: int |
Maps to entry i of hovered_line_widths_px, in pixels. |
line_dash_px_i: int |
Maps to entry i of dash_lengths_px, in pixels. |
Every key carries a series index, written i in the table, and there is no key without one. TauLineStyle describes the contents of a pane, so every key also accepts a pane index appended as a further number: line_width_px_0_1 names the first series of the second pane.
fills has no key of its own. A TauLineFill reads its own keys, from this same TauLine theme type variation and under the same two-level indexing, and they are listed on TauLineFill. Each of its fields scans its series index on its own, so a theme may define more entries for one field than for another.
Side effects¶
All properties are visual-only. A change triggers a redraw and never a layout recomputation.
Example¶
var line_overlay := TauLineConfig.new()
# Four series come out 1 pixel, 3 pixels, 1 pixel, 3 pixels.
line_overlay.style.line_widths_px = [1.0, 3.0]
# The second series is dashed, the others solid.
line_overlay.style.dash_lengths_px = [0, 6]
Notes¶
-
Zero width draws no line. An entry of
0inline_widths_pxdraws no line for that series and leaves only itsTauLineFill, the way to get an area chart with no outline. Such a series still reports hover on its samples. A series with neither a line nor a fill paints nothing and answers no hover. With every entry of the cycle at0and no fill left painting, the whole overlay comes out blank and the plot pushes a warning when the style is resolved. -
Hovered width never goes below the base width. A series whose
hovered_line_widths_pxentry sits below itsline_widths_pxentry is drawn at the base width instead, so a thick series never becomes thinner on hover. -
fillsmerges instead of replacing.line_widths_px,hovered_line_widths_px, anddash_lengths_pxdrop the themed cycle entirely once assigned.fillsdoes not: each entry merges with the themedTauLineFillat the same position, field by field, so an assigned field wins and an unassigned one keeps what the theme gave it. Anullentry leaves its whole position to the theme, and an empty array leaves the themed cycle untouched. When the two cycles differ in length, the resolved cycle is as long as the longer one and the shorter one repeats to fill it.
Constructor¶
new()¶
Creates a TauLineStyle holding the built-in default of every property.
Properties¶
line_widths_px¶
line_widths_px: Array[float]
Cycle holding the width of the curve of each series in the normal state, in pixels. Default is [2.0].
Read as a cycle: series i uses entry i % size, where i is the series index in the Dataset. Entries below 0.0 are raised to 0.0 as the array is stored. An empty array falls back to 2.0 for every series. See TauStyle.
An entry of 0 draws no line, see note 1.
hovered_line_widths_px¶
hovered_line_widths_px: Array[float]
Cycle holding the width of the two segments adjacent to the hovered sample, one entry per series, in pixels. Default is [3.0].
Read as a cycle: series i uses entry i % size, where i is the series index in the Dataset. Entries below 0.0 are raised to 0.0 as the array is stored. An empty array falls back to 0.0 for every series, a sentinel meaning no hover emphasis, which leaves those segments at the line_widths_px width. See TauStyle.
An entry of 0.0 reads as that same sentinel, since a width below the base width is drawn at the base width, see note 2.
The curve running nearest the cursor is the one emphasized, and a series drawn at width 0 has no curve to emphasize.
dash_lengths_px¶
dash_lengths_px: Array[int]
Cycle holding the dash length of the curve of each series, with an equal gap between dashes, in pixels. Default is [0].
Read as a cycle: series i uses entry i % size, where i is the series index in the Dataset. Entries below 0 are raised to 0 as the array is stored. An empty array falls back to 0 for every series. See TauStyle.
An entry of 0 draws a solid line.
fills¶
fills: Array[TauLineFill]
Cycle holding the area painted around the curve of each series. Default is an empty array, which paints nothing.
Read as a cycle: series i uses entry i % size, where i is the series index in the Dataset. An empty array falls back to a TauLineFill at its own built-in defaults for every series. See TauStyle.
This cycle merges with the themed one rather than replacing it, and a null entry is legal, see note 3.
Related Classes¶
TauStyleBase class. Defines the cascade, the cycle indexing, the theme key grammar, and the field-by-field merge.TauLineConfigOwns theTauLineStyleinstance through itsstyleproperty.TauLineFillDescribes the area painted around one curve. Held infillsand themed under the same theme type variation.LineVisualAttributesSupplies the per-sample color and alpha buffers a curve is stroked with.LineVisualCallbacksSupplies the same values as functions called at draw time.TauPaneOverlayConfigBase class ofTauLineConfig. Defines how a per-sample override is resolved.SampleHitReports the hit that decides which curve is emphasized.DatasetHolds the series a cycle index refers to.TauPlotThe plot node. Resolves the cascade and holds the Godot theme the second layer reads.TauXYStyleSibling style resource for the plot as a whole. Supplies the stroke color of a curve throughseries_colorsandseries_alphas.TauPaneStyleSibling style resource for the contents of one pane.TauBarStyleSibling style resource for bar overlays.TauScatterStyleSibling style resource for scatter overlays.TauLegendStyleSibling style resource for the legend.TauTooltipStyleSibling style resource for the hover tooltip.TauCrosshairStyleSibling style resource for the hover crosshair.