Skip to main content

GaugeTicks

Base class for the tick marks of a GaugeChart.

Ticks are spaced evenly along the gauge's arc, with the first one at the start of the arc and the last one at its end. They are positioned relative to the whole stack of rings, not to a single ring.

See usable subclasses:

Properties

  • count - The number of ticks, including the ones at both ends of the arc.
  • label_offset - The distance, in logical pixels, between the far edge of a tick and its label.
  • label_style - The text style of the labels.
  • labels - The labels drawn next to the ticks, one per tick, from the start of the arc to its end.
  • offset - The distance, in logical pixels, by which the ticks are moved from their position.
  • position - Where the ticks sit relative to the rings.
  • show_endpoints - Whether the ticks at both ends of the arc, and their labels, are drawn.

Properties​

countclass-attributeinstance-attribute​

count: int = 3

The number of ticks, including the ones at both ends of the arc.

Raises:

  • ValueError - If it is not greater than or equal to 2.
  • ValueError - If it is not equal to the length of labels, when labels is set.

label_offsetclass-attributeinstance-attribute​

label_offset: Number = 0

The distance, in logical pixels, between the far edge of a tick and its label.

Negative values pull the label toward, or across, the tick.

label_styleclass-attributeinstance-attribute​

label_style: TextStyle | None = None

The text style of the labels.

Defaults to the theme's TextTheme.body_medium.

labelsclass-attributeinstance-attribute​

labels: list[str] | None = None

The labels drawn next to the ticks, one per tick, from the start of the arc to its end.

An empty string keeps a tick without a label. If None, no labels are drawn. Labels stay upright whatever the angle of their tick.

Raises:

  • ValueError - If its length is not equal to count, when set.

offsetclass-attributeinstance-attribute​

offset: Number = 0

The distance, in logical pixels, by which the ticks are moved from their position.

It is measured away from the center for GaugeTickPosition.OUTER and GaugeTickPosition.CENTER, and toward the center for GaugeTickPosition.INNER. Negative values move the ticks the other way.

positionclass-attributeinstance-attribute​

Where the ticks sit relative to the rings.

show_endpointsclass-attributeinstance-attribute​

show_endpoints: bool = True

Whether the ticks at both ends of the arc, and their labels, are drawn.

Hiding them helps when the ends of the rings already mark the extremes of the scale, for example with round zone ends.