Generic super class for PolarAxisAmplitude and PolarAxisRadial.

Hierarchy

Implements

Properties

title: Eventer<LCJSInteractionEventMap, any> = ...

Interface for attaching listeners to user interaction events (click, pointerenter, etc.) on axis title.

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

For syntax examples, refer to EventInterface. Available event keys are listed under LCJSInteractionEventMap

Methods

  • Used in phase 1: after we know what ticks will be displayed, formulate generic information for chart layout calculations (e.g. XY layout for XY charts).

    Parameters

    • input: _GenericAxisInput
    • ticksInfo: Map<PolarAxisTick, _GenericTickInfo>
    • updatedTicks: boolean

    Returns _UpdateOutputAxisPolar

  • 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

  • Fit axis view to attached series.

    Parameters

    • Optional animate: number | boolean

      Boolean for animation enabled, or number for animation duration in milliseconds

    • Optional stopAxisAfter: boolean

      If true, stops Axis after fitting

    Returns PolarAxis

  • Format a value along axis to string. Behavior depends on the Axis' TickStrategy. Eq. A DateTime-Axis will interpret 'value' as a Date.

    Returns

    Value formated to string

    Parameters

    • value: number

      Value along axis

    Returns string

  • Get animations disable/enable state.

    Returns

    Animations default state.

    Returns boolean

  • Get current value of setIntervalRestrictions. By default, no restrictions.

    Returns undefined | {
        endMax?: number;
        endMin?: number;
        intervalMax?: number;
        intervalMin?: number;
        startMax?: number;
        startMin?: number;
    }

  • Get whether element can be target of pointer events or not.

    Returns

    Pointer events state

    Returns boolean

  • Get value of setScrollMargins

    Returns

    Scroll margins configuration

    Returns boolean | {
        end: number;
        start: number;
    }

  • Get data extents of series attached to the axis.

    Returns

    { min: number, max: number } or undefined.

    Returns undefined | Interval<number>

  • Get Axis stopped or not.

    When an Axis is stopped it temporarily prevents the active scroll strategy from changing the Axis interval.

    Axis can be stopped programmatically using this method, and also by different built in interactions, such as panning/zooming.

    Returns

    Axis stopped

    Returns boolean

  • Returns

    Axis title string

    Returns string

  • 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

  • Get rotation of Axis title.

    Returns

    Rotation in degrees

    Returns number

  • Get unit that Axis measures. e.g. "Hz", or "°C".

    • The unit is displayed after the Axis title (if it is defined). e.g. "Axis title (Hz)"
    • Default cursor formatters place the Unit next to units of the Axis.

    Returns undefined | string

  • 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

  • Specifies scroll animation.

    Parameters

    • enabled: undefined | boolean

      Boolean flag for whether scrolling should be animated or not.

    Returns PolarAxis

  • Specifies zoom animation to use.

    Example usage:

    Desired result Argument Parameters
    Change animation setAnimationZoom(AnimationEasings.easeOut, 500) First parameter defines the easing to use for the animation. Second parameter is optional, and defines the duration for the animation
    Disable zooming animations axis.setAnimationZoom(undefined) Passing undefined as the parameter will disable the zooming animations for the Axis.

    Parameters

    • easing: undefined | AnimationEasing

      Easing of animation. Undefined disables zoom animations. See 'common/animator.Easings' for defaults

    • duration: number = 300

      Optional default duration for zooming animations in milliseconds

    Returns PolarAxis

  • Disable/Enable all animations of the Chart.

    Returns

    Axis itself for fluent interface.

    Parameters

    • animationsEnabled: boolean

      Boolean value to enable/disable animations.

    Returns PolarAxis

  • Method that allows disabling Axis allocating automatic pixel based regions around data start and data end. For example, if Axis has attached point series with 10px size, the Axis can automatically add 10px gaps at both start and end.

    This behavior is enabled normally, but in some cases it can cause problems with several axes being out of sync, in which case they can be disabled with this method.

    Returns

    Object itself.

    Deprecated

    Deprecated in v7.1.0. Use setScrollMargins instead.

    Parameters

    • enabled: boolean

      Auto regions enabled or not.

    Returns PolarAxis

  • Set Axis default interval. This does the same as setInterval method, but is also applied again whenever fit is triggered, or the "zoom to fit" user interaction is triggered.

    Intended to be used in use cases that set an Axis interval nicely at start of application.

     // Example 1, set hardcoded interval at application start
    Axis.setDefaultInterval({ start: 0, end: 100 })

    This method also allows interval specification as a callback function, allowing the applied default interval to be based on the range of data or current axis interval:

     // Example 2, scrolling axis - when axis is fitted, restore default time window and continue scrolling
    Axis.setDefaultInterval((state) => ({
    end: state.dataMax ?? 0,
    start: (state.dataMax ?? 0) - 10_000,
    stopAxisAfter: false,
    }))
     // Example 3, add some extra space
    Axis.setDefaultInterval((state) => ({
    start: (state.dataMin ?? 0) - 10,
    end: (state.dataMax ?? 0) + 10,
    }))

    Optional extra arguments:

     // Configure default interval (to be applied on restoreDefault user interaction or axis.fit()), but don't apply it immediately
    Axis.setDefaultInterval({ start: 0, end: 10 }, { applyImmediately: false })

    By default, default interval ignores any interval restrictions that have been set. If undesirable, this can be changed by specifying skipIntervalRestrictions flag.

     // Don't skip interval restrictions
    Axis.setDefaultInterval({ start: 0, end: 10 }, { skipIntervalRestrictions: false })

    Parameters

    • arg: undefined | AxisIntervalConfiguration | ((state: {
          curEnd: number;
          curStart: number;
          dataMax: undefined | number;
          dataMin: undefined | number;
      }) => AxisIntervalConfiguration)
    • Optional opts: {
          applyImmediately?: boolean;
          skipIntervalRestrictions?: boolean;
      }
      • Optional applyImmediately?: boolean

        Potentially misleading naming, even if set to true, it doesn't mean that the interval is immediately configured after the setDefaultInterval call. Rather, the default interval is applied just before rendering next frame.

      • Optional skipIntervalRestrictions?: boolean

    Returns PolarAxis

  • Set axis interval.

    Examples:

     // Set interval start and end.
    Axis.setInterval({ start: 0, end: 5000 })
     // Set interval end only.
    Axis.setInterval({ end: 5000 })
     // Set interval but don't stop the axis from scrolling
    Axis.setInterval({ start: 0, end: 5000, stopAxisAfter: false })
     // Set interval with 2000 milliseconds long animation
    Axis.setInterval({ start: 0, end: 5000, animate: 2000 })

    Returns

    Object itself for fluent interface

    Parameters

    Returns PolarAxis

  • Set restrictions on Axis interval (start/end). These are not applied immediately, but affect all axis scrolling and user interactions afterwards.

     // Example 1, prevent zooming outside active data set
    Axis.setIntervalRestrictions((state) => ({
    startMin: state.dataMin,
    endMax: state.dataMax,
    }))
     // Example 2, set max zoom in level (intervalMin)
    Axis.setIntervalRestrictions({ intervalMin: 10 })
     // Example 3, set max zoom out level (intervalMax)
    Axis.setIntervalRestrictions({ intervalMax: 1000 })
     // Example 4, no restrictions
    Axis.setIntervalRestrictions(undefined)

    Parameters

    • arg: undefined | {
          endMax?: number;
          endMin?: number;
          intervalMax?: number;
          intervalMin?: number;
          startMax?: number;
          startMin?: number;
      } | ((state: {
          curEnd: number;
          curStart: number;
          dataMax: undefined | number;
          dataMin: undefined | number;
      }) => {
          endMax?: number;
          endMin?: number;
          intervalMax?: number;
          intervalMin?: number;
          startMax?: number;
          startMin?: number;
      })

    Returns PolarAxis

  • Set whether element can be target of pointer events or not.

    Disabling pointer events means that the objects below this component can be interacted through it.

    Returns

    Object itself for fluent interface

    Parameters

    • state: boolean

      Specifies state of mouse interactions

    Returns PolarAxis

  • Method that allows configuring extra space allocated around series data boundaries when axis is scrolling. Important, in LCJS context, scrolling refers to any automatic axis behavior adjusting according to attached series.

    By default, automatic scroll margins are enabled, which means the actual value is based on attached series and their style. For example, in case of point series, the scroll margins are set to half of point size.

     // Example, disable scroll margins entirely
    Axis.setScrollMargins(false)
     // Example, set specific scroll margins as pixels
    Axis.setScrollMargins(5)
     // Example, insymmetric scroll margins as pixels
    Axis.setScrollMargins({ start: 0, end: 10 })

    If axis interval is explicitly configured using setInterval or setDefaultInterval then scroll margins are not applied.

    Returns

    Object itself.

    Parameters

    • arg: undefined | number | boolean | {
          end: number;
          start: number;
      }

      Scroll margin configuration.

    Returns PolarAxis

  • Specify ScrollStrategy of the Axis. This decides where the Axis scrolls based on current view and series boundaries.

     // Example syntax
    chart.axisY.setScrollStrategy(AxisScrollStrategies.fitting)
    chart.axisX.setScrollStrategy(AxisScrollStrategies.scrolling)
    chart.axisY.setScrollStrategy(AxisScrollStrategies.fitting({ considerVisibleRangeOnly: false }))

    While technically it is possible to define custom axis scroll strategies by passing an object that satisfies this interface, this is not recommended.

    All known use cases can be realized with built-in scroll strategies. If you believe this is not the case, please contact us https://lightningchart.com/js-charts/docs/contact/

    Returns

    Object itself for fluent interface.

    Parameters

    Returns PolarAxis

  • Set Axis stopped or not.

    When an Axis is stopped it temporarily prevents the active scroll strategy from changing the Axis interval.

    Axis can be stopped programmatically using this method, and also by different built in interactions, such as panning/zooming.

     // Example, stop Axis scrolling / fitting.
    Axis.setStopped(true)

    Returns

    Object itself

    Parameters

    • stopped: boolean

      Axis stopped

    Returns PolarAxis

  • Specifies an Axis title string

    Returns

    Axis itself for fluent interface

    Parameters

    • title: string

      Axis title as a string

    Returns PolarAxis

  • 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 PolarAxis

  • Set unit that Axis measures. e.g. "Hz", or "°C". This is a convenience API that affects following things:

    • The unit is displayed after the Axis title (if it is defined). e.g. "Axis title (Hz)"
    • Default cursor formatters place the Unit next to units of the Axis.
     // Example syntax
    axis
    .setTitle('Frequency')
    .setUnits('Hz')

    axis.setUnits('Hz', { displayOnAxis: false })

    Returns

    Object itself.

    Parameters

    • units: undefined | string

      String or undefined.

    • behavior: AxisUnitsBehavior = {}

      Optional extra argument to control which side effects of configuring Units are enabled.

    Returns PolarAxis

  • Set element visibility.

    Returns

    Object itself.

    Parameters

    • state: boolean

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

    Returns PolarAxis