Skip to content

createOverlay(value) ​

createOverlay create an overlay.

Reference ​

typescript
(
  value:
    string |
    {
      name: string
      id?: string
      groupId?: string
      paneId?: string
      lock?: boolean
      visible?: boolean
      zLevel?: number
      needDefaultPointFigure?: boolean
      needDefaultXAxisFigure?: boolean
      needDefaultYAxisFigure?: boolean
      mode?: 'normal' | 'weak_magnet' | 'strong_magnet'
      modeSensitivity?: number
      points?: Array<{ timestamp: number, dataIndex?: number, value?: number }>
      extendData?: any
      styles?: object
      onDrawStart?: (event: object) => boolean
      onDrawing?: (event: object) => boolean
      onDrawEnd?: (event: object) => boolean
      onClick?: (event: object) => boolean
      onDoubleClick?: (event: object) => boolean
      onRightClick?: (event: object) => boolean
      onPressedMoveStart?: (event: object) => boolean
      onPressedMoving?: (event: object) => boolean
      onPressedMoveEnd?: (event: object) => boolean
      onMouseEnter?: (event: object) => boolean
      onMouseLeave?: (event: object) => boolean
      onRemoved?: (event: object) => boolean
      onSelected?: (event: object) => boolean
      onDeselected?: (event: object) => boolean
    } |
    Array<
      string |
      {
        name: string
        id?: string
        groupId?: string
        paneId?: string
        lock?: boolean
        visible?: boolean
        zLevel?: number
        needDefaultPointFigure?: boolean
        needDefaultXAxisFigure?: boolean
        needDefaultYAxisFigure?: boolean
        mode?: 'normal' | 'weak_magnet' | 'strong_magnet'
        modeSensitivity?: number
        points?: Array<{ timestamp: number, dataIndex?: number, value?: number }>
        extendData?: any
        styles?: object
        onDrawStart?: (event: object) => boolean
        onDrawing?: (event: object) => boolean
        onDrawEnd?: (event: object) => boolean
        onClick?: (event: object) => boolean
        onDoubleClick?: (event: object) => boolean
        onRightClick?: (event: object) => boolean
        onPressedMoveStart?: (event: object) => boolean
        onPressedMoving?: (event: object) => boolean
        onPressedMoveEnd?: (event: object) => boolean
        onMouseEnter?: (event: object) => boolean
        onMouseLeave?: (event: object) => boolean
        onRemoved?: (event: object) => boolean
        onSelected?: (event: object) => boolean
        onDeselected?: (event: object) => boolean
      }
    >
) => void

Parameters ​

  • value Overlay configuration, which can be an overlay name, an overlay object, or an array of overlay names and objects.
    • name Overlay name.
    • id Overlay id.
    • groupId Group id.
    • paneId Pane id.
    • lock Whether to lock and prevent dragging.
    • visible Whether it is visible.
    • zLevel Drawing level, the larger the value, the closer it is displayed to the front, and it only works between the overlays.
    • needDefaultPointFigure Whether the default point corresponding figures are required.
    • needDefaultXAxisFigure Whether to use the default x-axis for the figure.
    • needDefaultYAxisFigureWhether to use the default y-axis for the figure.
    • mode Mode, supports normal , weak_magnet and strong_magnet .
    • modeSensitivity Mode sensitivity, only valid when mode is weak_magnet .
    • points Point information.
    • extendData Custom the extend data.
    • styles Style configuration.
    • onDrawStart Start drawing event.
    • onDrawing Drawing event.
    • onDrawEnd Drawing end event.
    • onClick Click event.
    • onDoubleClick Double click event.
    • onRightClick Right click event.
    • onPressedMoveStart Press and hold to start moving the event.
    • onPressedMoving Press and hold the moving event.
    • onPressedMoveEnd Press and hold to end the move event.
    • onMouseEnter Mouse enter event.
    • onMouseLeave Mouse leave event.
    • onRemoved Delete event.
    • onSelected Select the event.
    • onDeselected Deselect the event.

Returns ​

createOverlay returns string or null or Array<string | null> .

Usage ​

Basic usage ​

Custom overlay ​

Create at once ​

Batch create ​