Class that represents a single polygon from the collection of a PolarPolygonSeries.

The geometry of the polygon can be mutated at any time.

Note, that the style of PolarPolygons is managed by the owning PolarPolygonSeries, to change the style, refer to the API of the Series.

Example usage:

 const polygonSeries = polarChart.addPolygonSeries()
let ang = 45
let amplitude = 50
const polygon = polygonSeries.addPolygon()
.setGeometry([
{ angle: (ang += 10), amplitude: (amplitude += 10) },
{ angle: (ang += 10), amplitude: (amplitude += 5) },
{ angle: (ang += 10), amplitude: (amplitude += 10) },
{ angle: (ang += 10), amplitude: (amplitude -= 5) },
{ angle: (ang += 10), amplitude: (amplitude += 5) },
{ angle: (ang += 5), amplitude: (amplitude -= 5) },
{ angle: (ang += 0), amplitude: (amplitude -= 10) },
{ angle: (ang -= 5), amplitude: (amplitude -= 5) },
{ angle: (ang -= 10), amplitude: (amplitude -= 10) },
{ angle: (ang -= 10), amplitude: (amplitude -= 5) },
{ angle: (ang -= 10), amplitude: (amplitude += 5) },
{ angle: (ang -= 10), amplitude: (amplitude += 10) },
])

Hierarchy

  • PolarPolygon

Implements

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 PolarPolygon

  • Get polygon geometry as a list of PolarPoints.

    NOTE: points have to be in either clockwise or counter-clockwise order

    Returns

    List of PolarPoints that form the contour of the desired polygon. Automatically closed.

    Returns undefined | PolarPoint[]

  • Get element visibility.

    Returns

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

    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 polygon geometry as a list of PolarPoints.

    NOTE: points have to be in either clockwise or counter-clockwise order. The polygon coordinates should also not intersect with themselves.

    Example usage:

     let ang = 45
    let amplitude = 50
    polarPolygon.setGeometry([
    { angle: (ang += 10), amplitude: (amplitude += 10) },
    { angle: (ang += 10), amplitude: (amplitude += 5) },
    { angle: (ang += 10), amplitude: (amplitude += 10) },
    { angle: (ang += 10), amplitude: (amplitude -= 5) },
    { angle: (ang += 10), amplitude: (amplitude += 5) },
    { angle: (ang += 5), amplitude: (amplitude -= 5) },
    { angle: (ang += 0), amplitude: (amplitude -= 10) },
    { angle: (ang -= 5), amplitude: (amplitude -= 5) },
    { angle: (ang -= 10), amplitude: (amplitude -= 10) },
    { angle: (ang -= 10), amplitude: (amplitude -= 5) },
    { angle: (ang -= 10), amplitude: (amplitude += 5) },
    { angle: (ang -= 10), amplitude: (amplitude += 10) },
    ])

    Parameters

    • geometry: PolarPoint[]

      List of PolarPoints that form the contour of the desired polygon. Automatically closed.

    Returns PolarPolygon

  • Set element visibility.

    Returns

    Object itself.

    Parameters

    • state: boolean

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

    Returns PolarPolygon