Class that represents a BarCharts Value Axis. It can be accessed through valueAxis property, and provides methods for configuring axis style, ticks and title.

Useful methods:

Hierarchy

  • GenericAxis<LinearScale1D | LogarithmicScale1D, AbstractAxisStrategy, _AbstractAxisTick, _BarChartTickPlottingVariables, undefined>
    • BarChartValueAxis

Methods

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

  • 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

  • Beta

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

    Released as beta feature in v5.1.0 feature may still change according to user feedback and experiences.
    

    Returns 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;
    })

  • 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 stroke style as a LineStyle object

    Returns LineStyle

  • Get Axis thickness min/max limits as pixels.

    For X Axis, this means Axis height.

    For Y Axis, this means Axis width.

    By default, Axis has no thickness restrictions, so getThickness should return { min: undefined, max: undefined }.

    Returns

    Actively configured Axis thickness limits as pixels.

    Returns {
        max: undefined | number;
        min: undefined | number;
    }

    • max: undefined | number
    • min: undefined | number
  • 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

  • Beta

    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.

                Introduced in LightningChart JS v6.0.0. Behavior or API might change in following versions depending on user feedback.
      

    Returns undefined | string

  • Get element visibility.

    Returns

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

    Returns boolean

  • Remove subscription from scale change event

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove event listener from event when Axis is stopped or released.

    This event is triggered when Axis.setStopped method is used (and state actually changes), or the Axis is stopped/released by a built-in user interaction.

     // Example, attach and remove event handler.
    const token = Axis.onStoppedStateChanged((_, isStopped) => {})

    Axis.offStoppedStateChanged(token)

    Parameters

    • token: Token

    Returns boolean

  • Remove subscription from mouse-click event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-doubleClick event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-down event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-drag event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-dragStart event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-dragStop event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-enter event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-leave event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-move event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from touch-start event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-up event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from mouse-wheel event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from touch-end event on Panel background

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove subscription from touch-move event on axis title

    Returns

    True if the listener is successfully removed and false if it is not found

    Parameters

    • token: Token

      Event listener

    Returns boolean

  • Remove event listener from visibleStateChanged

    Parameters

    • token: Token

    Returns boolean

  • Subscribe to on scale change event

    The onIntervalChange event triggers on change of the interval of an Axis and accept a callback function with 3 parameters that return axis itself, start and end values of the Axis

    Example usage:

    Axis.onIntervalChange((axis, start, end) => {
    console.log(`start value: ${start}, end value : ${end}`);
    }
    )

    Returns

    Token that is used to unsubscribe from the event

    Parameters

    Returns Token

  • Register new event listener to event when Axis is stopped or released.

    This event is triggered when Axis.setStopped method is used (and state actually changes), or the Axis is stopped/released by a built-in user interaction.

     // Example, track when Axis is stopped or released.
    const token = Axis.onStoppedStateChanged((_, isStopped) => {
    console.log({isStopped})
    })

    Returns

    Token of event subscription which can be used to remove the event listener using offStoppedStateChanged method.

    Parameters

    Returns Token

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

  • Beta

    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.

    Introduced in v5.2.0. Method may be removed/changed depending on how the related use cases evolve.

    Parameters

    • enabled: boolean

      Auto regions enabled or not.

    Returns BarChartValueAxis

  • Beta

    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,
    }))
    Released as beta feature in v5.1.0 feature may still change according to user feedback and experiences.
    

    Parameters

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

    Returns BarChartValueAxis

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

  • Beta

    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 })
    Released as beta feature in v5.1.0 feature may still change according to user feedback and experiences.
    

    Parameters

    • arg: {
          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 BarChartValueAxis

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

  • Set style of Axis line stroke.

    Supported line styles:

     // Example syntax, hide axis line
    barChart.valueAxis.setStrokeStyle(emptyLine)
     // Example syntax, specify LineStyle
    barChart.valueAxis.setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new SolidFill({ color: ColorHEX('#F00') })
    }))
     // Example syntax, change thickness only
    barChart.valueAxis.setStrokeStyle((stroke) => new SolidLine({ ...stroke, thickness: 5 }))

    Returns

    Object itself for fluent interface.

    Parameters

    Returns BarChartValueAxis

  • Set Axis thickness as pixels.

    For X Axis, this means Axis height.

    For Y Axis, this means Axis width.

     // Example syntax,
    Axis.setThickness( 60 )

    Returns

    Object itself for fluent interface.

    Parameters

    • thickness: number

      Explicit thickness of Axis as pixels.

    Returns BarChartValueAxis

  • Configure Axis thickness min/max limits as pixels.

    The thickness of Axis is calculated based on ticks, title, axis line, etc. By setting min and/or max thickness, the size allocated for Axis can be restricted to desired limits.

    For X Axis, this means Axis height.

    For Y Axis, this means Axis width.

     // Example syntax, set axis to at least 100 px thick, but allow larger axis thickness if labels are large, or other such scenario.
    Axis.setThickness({ min: 100, max: undefined })

    Returns

    Object itself for fluent interface.

    Parameters

    • thickness: {
          max?: number;
          min?: number;
      }

      Explicit thickness of Axis as pixels.

      • Optional max?: number
      • Optional min?: number

    Returns BarChartValueAxis

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

  • Beta

    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.

                Introduced in LightningChart JS v6.0.0. Behavior or API might change in following versions depending on user feedback.
    

    Parameters

    • units: undefined | string

      String or undefined.

    • behavior: AxisUnitsBehavior = {}

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

    Returns BarChartValueAxis