Skip to content
HatchStyle

HatchStyle

Mojo struct 🡭

HatchStyle

@memory_only
struct HatchStyle

A pattern drawn over a filled shape, dealt per category when Theme.fill_pattern_by_category is on.

Color alone cannot carry a series for a reader with a color-vision deficiency or on a grayscale printout, and a filled area has no marker shape or line dash to fall back on the way a scatter or a line does. A pattern is that second channel for fills. The first category stays solid, so a chart with one series looks as it did.

Aliases

  • NONE = HatchStyle(Int(0)): No pattern: the flat fill alone.
  • DIAGONAL = HatchStyle(Int(1)): Lines rising left to right, at 45 degrees.
  • HORIZONTAL = HatchStyle(Int(2)): Horizontal lines.
  • CROSS = HatchStyle(Int(3)): Horizontal and vertical lines: a grid.
  • BACK_DIAGONAL = HatchStyle(Int(4)): Lines falling left to right, at 45 degrees.
  • VERTICAL = HatchStyle(Int(5)): Vertical lines.
  • DOTS = HatchStyle(Int(6)): A staggered grid of dots.
  • DIAGONAL_CROSS = HatchStyle(Int(7)): Both diagonals: a diamond lattice.

Implemented traits

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the comptime constants over constructing one directly.

Args:

  • value (Int): 0 to 7, in the order the constants are declared.
  • self (Self)

Returns:

Self

__eq__

fn def __eq__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

__ne__

fn def __ne__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

name

fn def name(self) -> String

This style’s constant name, for messages.

Args:

  • self (Self)

Returns:

String: The constant’s name, or “HatchStyle()” outside them.