Chart Layout

Description

Chart layout widget. It provides the layout for the chart. It includes the axis, the grid, and the legend. It should not be used directly. It is used by the chart widgets.

Hierarchy

  • BaseChart
    • ChartLayout

Constructors

Properties

animationInstances: AnimationInstance<Widget>[] = []
centerX: number
centerY: number
children: Widget[] = []

The child-widgets of the widget.

cross: ChartAxis

The cross-axis of the chart.

data: BaseChartData

The data of the chart.

dateFormatOptions?: DateTimeFormatOptions

The date format options of the index-axis.

display: boolean = true
edgeOffset: boolean

Whether the grid aligns with the edge.

Default

false

Description

Whether the grid aligns with the edge.

eventInstances: EventInstance<Widget>[] = []
fillPaint: Paint
gridAlign: boolean

Whether the grid aligns with the index-axis.

Default

true

Description

Whether the grid aligns with the index-axis.

hasSet: boolean = false
index: ChartAxis

The index-axis of the chart.

indexAxis: "x" | "y"

The index-axis of the chart.

Default

'x'

Description

The index-axis of the chart.

indexIntervalUnit?: DateTimeUnit

The interval unit of the index-axis.

indexType: "number" | "label" | "date"

The type of the index-axis.

Default

'label'

Description

BaseChartOptions#indexType

isImplemented: boolean = false
key: string = ...
last: Widget = ...
legendLabels: Text[]

The legend labels of the chart.

legends: Rect[]

The legends of the chart.

paint: Paint

The paint of the chart layout.

parent: Widget
plugins: WidgetPlugin[] = []
progress: number
setups: {
    generator: Generator<number | {
        animation: Animation<any>;
        duration: number;
        mode: "async" | "sync";
        params: Record<string, any>;
        setAsync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
        setSync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
    }, void, unknown>;
    nextFrame: number;
}[] = []

Type declaration

  • generator: Generator<number | {
        animation: Animation<any>;
        duration: number;
        mode: "async" | "sync";
        params: Record<string, any>;
        setAsync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
        setSync: (() => { animation: Animation<any>; mode: "async" | "sync"; duration: number; params: Record<string, any>; setAsync: () => ...; setSync: () => ...; });
    }, void, unknown>
  • nextFrame: number
size: {
    height: number;
    width: number;
}

The size of the chart layout.

Type declaration

  • height: number

    The height of the chart layout.

    Default

    300
    

    Description

    The height of the chart layout. To be noted that the height is the height of chart layout (excluding label, legend, etc.).

  • width: number

    The width of the chart layout.

    Default

    300
    

    Description

    The width of the chart layout. To be noted that the width is the width of chart layout (excluding label, legend, etc.).

Default

{ width: 300, height: 300 }

Description

The size of the chart layout.

strokePaint: Paint

The style of the chart layout.

updates: ((elapsed, widget) => void)[] = []

Type declaration

    • (elapsed, widget): void
    • Parameters

      Returns void

x: number
y: number

Accessors

Methods

  • Add children widgets for the widget.

    Parameters

    • Rest ...children: Widget[] | ((parent) => Widget)[]

      The added children.

    Returns this

  • Parameters

    • animation: Animation<any>
    • startAt: number
    • during: number
    • Optional params: Record<string, any>

    Returns this

  • Draw the object according to the parameters of the widget. Called when the parameters is changed.

    Parameters

    • _canvas: Canvas

      The canvas object of CanvasKit-WASM.

    Returns void

  • Private

    Generate the axis range and the positions of the axis labels.

    Parameters

    • axis: ChartAxis

      The axis.

    • data: number[]

      The data.

    Returns void

  • Called when the widget is registered.

    Parameters

    • _ck: CanvasKit

      The CanvasKit namespace

    Returns void

  • Parameters

    • event: Event<Widget>
    • effect: ((widget, ...args) => any)
        • (widget, ...args): any
        • Parameters

          • widget: Widget
          • Rest ...args: any[]

          Returns any

    Returns this

  • Called when the parameters is changed.

    Parameters

    • ck: CanvasKit

      The namespace of CanvasKit-WASM.

    • Optional propertyChanged: string

    Returns void

  • Parameters

    • element: HTMLCanvasElement

    Returns void

  • Set up a update function to call it when the widget is changed.

    Parameters

    • updateFunc: ((elapsed, widget) => void)

      The frame from having gone to current frame.

        • (elapsed, widget): void
        • Parameters

          Returns void

    Returns this

  • Update the object according to the style of the widget. Called when the style is changed.

    Parameters

    • canvas: Canvas

      The canvas object of CanvasKit-WASM.

    Returns void

  • Parameters

    • widget: Widget
    • x: number
    • y: number

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number
  • Parameters

    Returns {
        x: number;
        y: number;
    }

    • x: number
    • y: number