Class BorderedPictureAbstract

Abstract Picture with stylable border.

Hierarchy

Properties

origin: Point = ...
position: Point = ...

Pixel location of UiElements origin. To get position use getPosition(relativePosition).

Coordinate system = position scale (UIElement.scale)

renderingScale: LinearScaleXY
scale: ScaleXY<ViewportScale1D>
size: Point = ...

Accessors

  • get draggable(): boolean
  • Returns boolean

  • set draggable(state: boolean): void
  • Parameters

    • state: boolean

    Returns void

Methods

  • Add callback function to be triggered when specified event is fired.

     // Example syntax
    object.addEventListener('click', (event) => {
    console.log(event)
    })

    Some classes also report extra information about the interacted object with the second parameter:

     // Most series share information about interacted data point
    series.addEventListener('click', (event, info) => {
    console.log(info)
    })

    Optional third parameter allows registering event handlers that will automatically remove themselves after first trigger:

     // Example this listener will only fire once
    object.addEventListener('click', (event) => {})

    Each class has its own list of supported events. Some events are from HTML standard (click, pointerdown, etc.), while others are own events from LightningChart JS (dispose, resize, etc.)

    To find what events are available, you can try following:

    • If your development environment has TypeScript enabled, just write addEventListener and see what possible event types the IDE suggests. These APIs are strongly typed, and even the callback event will be correctly typed.
    • Otherwise, open the class section in API documentation and check out which interface K type parameter extends.

    Type Parameters

    Parameters

    Returns void

  • Permanently destroy the component.

    To fully allow Garbage-Collection to free the resources used by the component, make sure to remove any references to the component and its children in application code.

    let chart = ...ChartXY()
    let axisX = chart.getDefaultAxisX()
    // Dispose Chart, and remove all references so that they can be garbage-collected.
    chart.dispose()
    chart = undefined
    axisX = undefined

    Returns

    Object itself for fluent interface

    Returns BorderedPicture

  • Get theme effect enabled on component or disabled.

    A theme can specify an Effect to add extra visual oomph to chart applications, like Glow effects around data or other components. Whether this effect is drawn above a particular component can be configured using the setEffect method.

     // Example, disable theme effect from a particular component.
    Component.setEffect(false)

    For the most part, theme effects are enabled by default on most components.

    Theme effect is configured with effect property.

    Returns

    Boolean that describes whether drawing the theme effect is enabled around the component or not.

    Returns boolean

  • Returns

    1 for highlighted state of object and 0 for basic

    Returns number

  • Get the position origin of this UiElement. Affects how the "position" of UIElement is interpreted.

    Returns

    Vec2 with each plane in range [-1, 1], where 0 is middle

    Returns Point

  • Returns

    Mouse interactions state

    Returns boolean

  • Returns the position of this UiElement at given location relative to elements size.

    Returns

    Object itself for fluent itself

    Parameters

    • relativePosition: Point = ...

      Relative position vector (-1 to 1 which specifies position of origin, 0 is center of the object)

    • spaceOfInterest: UISpace = UISpace.Everything

      Parameter to disregard parts of object when calculating the asked position. Defaults to Margin, which includes everything. Should only ever be necessary for other UiElements

    Returns Point

  • Returns the size of the UiElements in pixels including any Margins or Paddings

    Returns

    Object size in pixels

    Parameters

    • spaceOfInterest: UISpace = UISpace.Everything

      Parameter to disregard parts of object when calculating the position. Defaults to Margin, which includes everything. Should only ever be necessary for sub-classes

    Returns Point

  • Get element visibility.

    Returns

    true when element is set to be visible and false otherwise.

    Returns boolean

  • Check whether the object is disposed. Disposed objects should not be used!

    Returns

    true if object is disposed.

    Returns boolean

  • Remove event listener added using addEventListener. The expected argument should be the exact same callback function that was supplied using addEventListener:

     // Basic example syntax
    const listener = () => {}
    obj.addEventListener('click', listener)
    obj.removeEventListener('click', listener)
     // Basic boilerplate of custom interaction when user drags on an object
    obj.addEventListener('pointerdown', (eventDown) => {
    let prevCoord = eventDown
    const handlePointerMove: LCJSInteractionEventListener<'pointermove'> = (eventMove) => {
    const delta = { x: eventMove.clientX - prevCoord.clientX, y: eventMove.clientY - prevCoord.clientY }
    prevCoord = eventMove
    console.log(delta, eventMove.clientX, eventMove.clientY)
    }
    const handlePointerUp: LCJSInteractionEventListener<'pointerup'> = (eventUp) => {
    window.removeEventListener('pointermove', handlePointerMove)
    window.removeEventListener('pointerup', handlePointerUp)
    }
    window.addEventListener('pointermove', handlePointerMove)
    window.addEventListener('pointerup', handlePointerUp)
    })

    Type Parameters

    Parameters

    Returns void

  • Set auto dispose behavior for this UI element.

    Can be used to set a condition, where the UI element is automatically disposed, removing it from view.

     // Example, remove UI element when it is larger than 20% of viewport.
    UIElement.setAutoDispose({
    type: 'max-width',
    maxWidth: 0.20,
    })

    Returns

    Object itself for fluent interface.

    Parameters

    Returns BorderedPicture

  • Member function that updates the size of the UI elements contents. UiElements should apply this inside 'update'

    Parameters

    • sizeInPixels: Point

      Size of element in pixels

    Returns void

  • Set theme effect enabled on component or disabled.

    A theme can specify an Effect to add extra visual oomph to chart applications, like Glow effects around data or other components. Whether this effect is drawn above a particular component can be configured using the setEffect method.

     // Example, disable theme effect from a particular component.
    Component.setEffect(false)

    For the most part, theme effects are enabled by default on most components.

    Theme effect is configured with effect property.

    Returns

    Object itself.

    Parameters

    • enabled: boolean

      Theme effect enabled

    Returns BorderedPicture

  • Set state of component highlighting.

     // Example usage

    component.setHighlight(true)

    component.setHighlight(0.5)

    Returns

    Object itself

    Parameters

    • highlight: number

      Boolean or number between 0 and 1, where 1 is fully highlighted.

    Returns BorderedPicture

  • Set margin around object in pixels.

    Returns

    Object itself

    Parameters

    • margin: number | Partial<MMargin>

      Number with pixel margins for all sides or datastructure with individual pixel margins for each side. Any side can be omitted, only passed values will be overridden.

    Returns BorderedPicture

  • Sets the position of this UiElement relative to its origin.

    NOTE: UIElements scale can't be changed apart from when it is created.

    Returns

    Object itself

    Parameters

    • position: Point

      Location on the UIElements scale, where its origin should be positioned

    Returns BorderedPicture

  • Set element visibility.

    Returns

    Object itself.

    Parameters

    • state: boolean

      true when element should be visible and false when element should be hidden.

    Returns BorderedPicture