Skip to content
ChartLike

ChartLike

Mojo trait 🡭

ChartLike

What the render pipeline needs from a chart, whether its mark is a type (Chart[M]) or erased (AnyChart): the shared settings by value, the mark id, the canvas size, the continuous columns the smooth and best-fit annotations regress over, and the mark’s own draw. Trait methods cannot return references, so the settings come back as copies; the pipeline takes them once per render.

Implemented traits

AnyType, Copyable, Deinitable, Movable

Methods

id

fn def id(self) -> Mark

Args:

  • self (_Self)

Returns:

Mark

canvas_width

fn def canvas_width(self) -> Int

Args:

  • self (_Self)

Returns:

Int

canvas_height

fn def canvas_height(self) -> Int

Args:

  • self (_Self)

Returns:

Int

chart_settings

fn def chart_settings(self) -> _ChartSettings

Args:

  • self (_Self)

Returns:

_ChartSettings

mark_style

fn def mark_style(self) -> _MarkStyle

Args:

  • self (_Self)

Returns:

_MarkStyle

chart_annotations

fn def chart_annotations(self) -> _AnnotationData

Args:

  • self (_Self)

Returns:

_AnnotationData

x_data

fn def x_data(self) -> List[Float64]

Args:

  • self (_Self)

Returns:

List[Float64]

y_data

fn def y_data(self) -> List[Float64]

Args:

  • self (_Self)

Returns:

List[Float64]

scaled_by

fn def scaled_by(self, factor: Float64) -> Self

A copy sized for save(dpi=...): the canvas and the theme’s scale multiplied by factor.

Args:

  • self (_Self)
  • factor (Float64)

Returns:

_Self

erased

fn def erased(self) -> AnyChart

This chart with its mark type erased, for a List[AnyChart].

Args:

  • self (_Self)

Returns:

AnyChart

erased_with

fn def erased_with[canvas: Bool = False, svg: Bool = False, pdf: Bool = False, bounds: Bool = False, display_list: Bool = False](self) -> AnyChart

erased() with only the named targets’ renders bound, for a composition entry that knows which targets it draws marks into and never hands the chart on, or with display_list=True for an erased chart that record() will draw. Drawing the mark into an unbound target raises. See AnyChart.

Parameters:

  • canvas (Bool)
  • svg (Bool)
  • pdf (Bool)
  • bounds (Bool)
  • display_list (Bool)

Args:

  • self (_Self)

Returns:

AnyChart

capabilities

fn def capabilities(self) -> _Capabilities

What this chart’s mark honors, from its type’s constants.

Args:

  • self (_Self)

Returns:

_Capabilities

render_mark

fn def render_mark[T: DrawTarget](self, mut target: T, ox0: Int, oy0: Int, ox1: Int, oy1: Int, has_shared_y_domain: Bool, shared_y_min: Float64, shared_y_max: Float64, shared_y_is_log: Bool, *, mut cache: FontCache, vector_target: Bool) -> _RenderResult

Parameters:

  • T (DrawTarget)

Args:

  • self (_Self)
  • target (T)
  • ox0 (Int)
  • oy0 (Int)
  • ox1 (Int)
  • oy1 (Int)
  • has_shared_y_domain (Bool)
  • shared_y_min (Float64)
  • shared_y_max (Float64)
  • shared_y_is_log (Bool)
  • cache (FontCache)
  • vector_target (Bool)

Returns:

_RenderResult

Raises: