Timeline self. There are 2 way to draw a timeline.

  1. draw a timeline base on event list.
  2. draw a timeline base an TimelineData. For No.1, there are like:
const timeline = new Timeline(...);
timeline.event = [...];
await timeline.apply();
timeline.draw();
```js

For No.2, Ensure you had a TimelineData, and run like this for draw a timeline:
(The TimelineData is generate by timeline.export())
```js
const timeline = new Timeline(...);
await timeline.drawFrom(timelineData);

Hierarchy

Constructors

Properties

axis: Axis = ...
axisConstructor: typeof Axis
canvas: HTMLCanvasElement

The canvas where component draw on.

container: HTMLElement

The container which contain all of component's element.

destroyed: boolean = false

Means that the component has been destroyed. Call any method on component when it has destroyed will got an error.

drawInfo: DrawInfo = ...

All info about draw. Except drawInfo, no more states be depended about draw. The same drawInfo must has same drawn on canvas and container. The this.gird should be merging in there in this.apply be called. Must can unscathed passed this.drawInfo = JSON.parse(JSON.stringify(this.drawInfo)).

element?: HTMLElement

Optional. Be filled in this.createElement. The HTML element which be needed by component draw.

eventConstructor: typeof Event
events: Event[] = []

Manage all extensions & Help component communicate for each other.

extraData: ExtraData = {}

An ext extra

See

ExtraData

name: SN = SN.Timeline

Component name. Be filled when the engine's class constructed.

ratio: number = ...

A ratio for draw, it's using when draw on High DPI display

runtime: RuntimeInfo = ...

Generated after timeline.apply() called. If you wanna to specify some keys, passed a object when timeline.apply() called.

See

RuntimeInfo

theme: string

Theme name. Be filled when the theme's class constructed.

defaultGrid: GridConfig = ...

Accessors

  • get l(): ((stringArr: TemplateStringsArray, ...values: any[]) => void)
  • Print log if the DEBUG is true.

    Example

    this.lHello world

    Returns ((stringArr: TemplateStringsArray, ...values: any[]) => void)

      • (stringArr: TemplateStringsArray, ...values: any[]): void
      • Parameters

        • stringArr: TemplateStringsArray
        • Rest ...values: any[]

        Returns void

Methods

  • Parameters

    • Optional runtime: Partial<RuntimeInfo>

      manually specify some runtime info.

    Returns Promise<MustCallAndReturnSuperMethod>

  • Create a box object to fill this.drawInfo.box. It should be called in apply() at least once. Write this method if you need to change the behavior about box.

    Returns void

  • Optional. Depend on the draw this component is need HTML element or not. Create an HTML element base on this.drawInfo to fill this.element and append to this.container. Be called in this.apply and this.draw.

    Returns MustCallAndReturnSuperMethod

  • Destroy self. It should remove all element from dom and clear all trace in canvas if that's made by self.

    Returns MustCallAndReturnSuperMethod

  • Download a timeline image for user It's available after after draw() been called

    Parameters

    • filename: string = ...

    Returns Promise<void>

  • Draw self base on this.drawInfo. It should can be call multiple times. Call this.apply before this.draw.

    Returns MustCallAndReturnSuperMethod

  • Export a TimelineData for current timeline. Make sure call timeline.apply() before call this method.

    Returns

    Returns any

  • Hide all of trace created by self. Hidden is not destroyed. Ensure the component is still available when this.hide have call. This method will try set "visibility: 'hidden'" for this.element rather than remove it.

    Returns MustCallAndReturnSuperMethod

  • Draw a timeline base on a TimelineData. (The TimelineData is generated by timeline.export())

    Returns

    Parameters

    • input: any

    Returns Promise<void>

  • Generate a pure image base timeline. It's available after after draw() been called

    Returns Promise<HTMLCanvasElement>

  • Mount a HTML element adding canvas and container. The HTML element passed will be cleared.

    Parameters

    • el: string | Element
    • themeName: string

    Returns { canvas: HTMLCanvasElement; container: HTMLElement }

    • canvas: HTMLCanvasElement
    • container: HTMLElement

Generated using TypeDoc