Axis is a child component of ChartXY. It defines a numeric range on a single plane (X or Y), that will be used to scale attached Series to the ChartXYs viewport.

The default Axis can be referenced with getDefaultAxisX and getDefaultAxisY.

ChartXY doesn't have a limit on number of axes. Additional axes can be created with addAxisX and addAxisY. Multiple Axes can be stacked on top of another, and axes can be positioned on either side of the chart (left, right, top, bottom, see AxisOptions).

The visual components of axis are:

See Scrolling and interval configuration for detailed information about management of axis interval.

Axis Ticks

Ticks are labels attached to the axis line that visualize the progression of values along the axis. A tick consists of three individually stylable parts:

  • Label (text)
  • Tick line.
  • Grid line.

There are currently three different ways of managing axis ticks:

  1. Automatic numeric ticks (default).
  2. Automatic time ticks.
  3. Automatic datetime ticks.
  4. Custom ticks.
Numeric ticks

Numeric ticks are enabled by default for all axes. They are designed for depicting numeric values of all magnitudes.

Configuring the ticks is done with setTickStrategy.

Axis.setTickStrategy(AxisTickStrategies.Numeric, (strategy) => strategy
// Configure NumericTickStrategy
.setMinorFormattingFunction((tickPosition) => `X: ${tickPosition}`)
.setMinorTickStyle((tickStyle: VisibleTicks) => tickStyle
.setTickLength(12)
.setTickPadding(2)
)
)

Frequently used API:

For full list of configuration API, see NumericTickStrategy.

Examples showcasing numeric axes:

Time ticks

Time ticks are designed for depicting time ranges between hundreds of hours to individual nanoseconds.

They are enabled, as well as configured, with setTickStrategy.

Axis.setTickStrategy(AxisTickStrategies.Time, (strategy) => strategy
// Configure TimeTickStrategy
.setMinorFormattingFunction((tickPosition) => `X: ${tickPosition}`)
.setMinorTickStyle((tickStyle: VisibleTicks) => tickStyle
.setTickLength(12)
.setTickPadding(2)
)
)

Frequently used API:

For full list of configuration API, see TimeTickStrategy.

Examples showcasing TimeTickStrategy:

  • No listed examples as of yet.
Datetime ticks

DateTime ticks are enabled, as well as configured, with setTickStrategy.

Axis.setTickStrategy(AxisTickStrategies.DateTime, (strategy) => strategy
// Configure DateTimeTickStrategy
.setMinorTickStyle((tickStyle: VisibleTicks) => tickStyle
.setTickLength(12)
.setTickPadding(2)
)
)

Frequently used API:

For full list of configuration API, see DateTimeTickStrategy.

Examples showcasing datetime axes:

Custom ticks

Automatic creation of ticks can be disabled with setTickStrategy:

// Disable automatic axis ticks.
Axis.setTickStrategy(AxisTickStrategies.Empty)

Custom ticks can be created with addCustomTick:

// Create custom ticks.
for (let x = 0; x < 100; x += 10) {
const tick = Axis.addCustomTick(UIElementBuilders.AxisTickMajor)
}

Frequently used CustomTick API:

Examples showcasing custom axis ticks:

Axis automatic scrolling and Axis intervals configuration

Axis interval is the range of data values that are visible on the Axis, they are referred to as start and end.

By default, all axes fit the interval automatically to reveal all attached series. This behavior is called fitting scroll strategy.

Automatic scrolling behavior can be controlled by selecting the scroll strategy, with setScrollStrategy:

// Select progressive scroll strategy.
Axis.setScrollStrategy(AxisScrollStrategies.progressive)

Following scroll strategies are supported:

Axis interval can be manually set with setInterval:

// Axis start = 0, end = 100.
Axis.setInterval({ start: 0, end: 100 })

Setting Axis interval stops axis scrolling by default. To specify axis interval and keep auto scrolling enabled, use the optional stopAxisAfter parameter:

Axis.setInterval({ start: 0, end: 100, stopAxisAfter: false })

Frequently used methods:

  • setScrollStrategy | configure automatic scrolling behavior.
  • setInterval | configure active axis interval.
  • getInterval | get active axis interval.
  • fit | fit axis interval to contain all attached series boundaries.
  • Axis.stop | stop automatic scrolling momentarily.
  • onIntervalChange | trigger a custom action whenever axis scale changes.
  • setAnimationScroll | Enable/disable automatic scrolling animation.
Axis interval limitations

LightningChart JS is easily the market leader in zooming interactions and visualization resolution, and contrary to most chart libraries, we are open about axis zooming limits;

"Axis zooming limits" refer to constraints on the magnitude of Axis interval, which is calculated as Math.abs(end - start). When the limit is reached, the Axis will not be able to zoom in and out further by programmatic calls (setInterval) or user interactions.

The constraints are primarily affected by two factors:

  • Active Tick Strategy.
  • Axis type.

Both of these factors have their own definition of support minimum and maximum Axis interval, and when combined the lesser values are used. For example, if Tick Strategy would allow min interval of 0.001 and Axis type 0.005, effectively the min interval would be 0.001.

The Axis interval limits imposed by each available Tick Strategy are documented at AxisTickStrategies.

The Axis interval limits imposed by Axis Type are documented at AxisOptions.

Axis highlighters

Two kinds of highlighters are supported:

  • ConstantLine | highlights a position on the Axis.
  • Band | highlights a range on the Axis.

Examples showcasing axis highlighters:

Hierarchy

Implements

Methods

addBand addConstantLine addCustomTick dispose fit formatValue getAnimationHighlight getAnimationsEnabled getAxisInteractionPanByDragging getAxisInteractionReleaseByDoubleClicking getAxisInteractionZoomByDragging getAxisInteractionZoomByWheeling getAxisMouseHoverStyle getAxisMousePanStyle getAxisMouseZoomStyle getChartInteractionFitByDrag getChartInteractionPanByDrag getChartInteractionZoomByDrag getChartInteractionZoomByWheel getHighlighters getInterval getNibInteractionScaleByDragging getNibInteractionScaleByWheeling getNibLength getNibMouseHoverStyle getNibMousePickingAreaSize getNibMouseScaleStyle getNibOverlayStyle getNibStyle getOverlayStyle getScrollStrategy getStopped getStrokeStyle getThickness getTickStrategy getTitle getTitleEffect getTitleFillStyle getTitleFont getTitleMargin getTitleRotation getUiPosition getVisible offAxisInteractionAreaMouseClick offAxisInteractionAreaMouseDoubleClick offAxisInteractionAreaMouseDown offAxisInteractionAreaMouseDrag offAxisInteractionAreaMouseDragStart offAxisInteractionAreaMouseDragStop offAxisInteractionAreaMouseEnter offAxisInteractionAreaMouseLeave offAxisInteractionAreaMouseMove offAxisInteractionAreaMouseUp offAxisInteractionAreaMouseWheel offAxisInteractionAreaTouch offAxisInteractionAreaTouchStart offAxisInteractionAreaTouchStop offDispose offIntervalChange offStoppedStateChanged offVisibleStateChanged onAxisInteractionAreaMouseClick onAxisInteractionAreaMouseDoubleClick onAxisInteractionAreaMouseDown onAxisInteractionAreaMouseDrag onAxisInteractionAreaMouseDragStart onAxisInteractionAreaMouseDragStop onAxisInteractionAreaMouseEnter onAxisInteractionAreaMouseLeave onAxisInteractionAreaMouseMove onAxisInteractionAreaMouseUp onAxisInteractionAreaMouseWheel onAxisInteractionAreaTouch onAxisInteractionAreaTouchStart onAxisInteractionAreaTouchStop onDispose onIntervalChange onStoppedStateChanged onVisibleStateChanged pan setAnimationHighlight setAnimationScroll setAnimationZoom setAnimationsEnabled setAxisInteractionPanByDragging setAxisInteractionReleaseByDoubleClicking setAxisInteractionZoomByDragging setAxisInteractionZoomByWheeling setAxisMouseHoverStyle setAxisMousePanStyle setAxisMouseZoomStyle setChartInteractionFitByDrag setChartInteractionPanByDrag setChartInteractionZoomByDrag setChartInteractionZoomByWheel setChartInteractions setInterval setMouseInteractions setNibInteractionScaleByDragging setNibInteractionScaleByWheeling setNibLength setNibMouseHoverStyle setNibMousePickingAreaSize setNibMouseScaleStyle setNibOverlayStyle setNibStyle setOverlayStyle setScrollStrategy setStopped setStrokeStyle setThickness setTickStrategy setTitle setTitleEffect setTitleFillStyle setTitleFont setTitleMargin setTitleRotation setVisible zoom

Methods

  • Add a highlighter Band to the Axis. A Band can be used to highlight an interval on the Axis.

    Returns

    Band object.

    Parameters

    • onTop: boolean = true

      Is Band rendered above Series, or below. Default to above.

    Returns Band

  • Add a highlighter ConstantLine to the Axis. A ConstantLine can be used to highlight a specific value on the Axis.

    Returns

    ConstantLine object.

    Parameters

    • onTop: boolean = true

      Is ConstantLine rendered above Series, or below. Default to above.

    Returns ConstantLine

  • Add custom tick to Axis. Custom ticks can be used to expand on default tick placement, or completely override Axis ticks placement with custom logic.

    Example usage:

    Create custom tick, specify position on Axis and label text.

     const customTick = Axis.addCustomTick(UIElementBuilders.PointableTextBox)
    .setValue(5)
    // Label text is specified with a callback function.
    // This example formats Axis positions with one fraction, like this: "5.0"
    .setTextFormatter((value) => value.toFixed(1))

    Select CustomTick Marker type.

     // CustomTick shape can be changed by supplying a tick marker builder.
    // The supported values are 'AxisTickMajor', 'AxisTickMinor' and 'PointableTextBox'
    const customTick1 = Axis.addCustomTick(UIElementBuilders.AxisTickMajor)
    const customTick2 = Axis.addCustomTick(UIElementBuilders.AxisTickMinor)
    const customTick3 = Axis.addCustomTick(UIElementBuilders.PointableTextBox)

    Disable default ticks, and create custom positioned ticks.

     // Disable default Axis ticks.
    Axis.setTickStrategy(AxisTickStrategies.Empty)

    // Create a bunch of custom positioned ticks.
    for (let x = 0; x <= 100; x += 10) {
    Axis.addCustomTick()
    .setValue(x)
    }

    For more information, like styling custom ticks, see CustomTick.

    Returns

    CustomTick.

    Parameters

    Returns CustomTick

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

  • Fit axis view to attached series.

    Parameters

    • Optional animate: number | boolean

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

    • stopAxisAfter: boolean = false

      If true, stops Axis after fitting

    Returns Axis

  • 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 component highlight animations enabled or not.

    Returns

    Animation enabled?

    Returns boolean

  • Get animations disable/enable state.

    Returns

    Animations default state.

    Returns boolean

  • Get is mouse-interaction enabled: Panning by dragging on axis. (RMB)

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Release axis by double-clicking on axis.

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Zooming by dragging on axis. (LMB)

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Zooming by mouse-wheeling on axis.

    Returns

    Boolean flag

    Returns boolean

  • Get mouse style when hovering over axis area.

    Returns

    Mouse-style preset name

    Returns string

  • Get mouse style when panning axis.

    Returns

    Mouse-style preset name

    Returns string

  • Get mouse style when zooming axis.

    Returns

    Mouse-style preset name

    Returns string

  • Get is mouse-interaction enabled: Fitting by capturing rectangle on chart.

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Panning by dragging on chart.

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Zooming by capturing rectangle on chart.

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Zooming by mouse-wheeling on chart.

    Returns

    Boolean flag

    Returns boolean

  • Get all Highlighters of Axis.

    Returns

    array of highlighters

    Returns Highlighter[]

  • Get is mouse-interaction enabled: Scaling by dragging on nib.

    Returns

    Boolean flag

    Returns boolean

  • Get is mouse-interaction enabled: Scaling by mouse-wheeling on nib.

    Returns

    Boolean flag

    Returns boolean

  • Returns

    Axis nib stroke length in pixels

    Returns number

  • Get mouse style when hovering over nib area.

    Returns

    Mouse-style preset name

    Returns string

  • Get size of nib mouse-picking area in pixels.

    Returns

    Size in pixels

    Returns number

  • Get mouse style when hovering over nib area.

    Returns

    Mouse-style preset name

    Returns string

  • Get style of nib overlay (shown only when interacting with mouse / touch).

    Returns

    FillStyle object

    Returns FillStyle

  • Returns

    nib stroke fillstyle as a Fillstyle object

    Returns LineStyle

  • Get style of axis overlay (shown only when interacting with mouse / touch).

    Returns

    FillStyle object

    Returns FillStyle

  • 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

  • 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
  • Get the currently used tick strategy

    Returns "Empty" | "Numeric" | "DateTime" | "Time"

  • 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

  • Returns

    Padding after Axis title

    Returns number

  • Get rotation of Axis title.

    Returns

    Rotation in degrees

    Returns number

  • Get position of axis on its chart as a %

    Returns number

  • Get element visibility.

    Returns

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

    Returns boolean

  • Remove event listener from Mouse Click event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Double Click event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Down event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Drag event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Drag Start event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Drag Stop event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Enter event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Leave event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Move event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Up event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Wheel event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Touch event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Touch Start event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from Mouse Touch Stop event

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    Returns boolean

  • Remove event listener from dispose event.

    Returns

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

    Parameters

    • token: Token

      Token of event listener which has to be removed

    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 event listener from visibleStateChanged

    Parameters

    • token: Token

    Returns boolean

  • Add event listener to Mouse Click on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Double Click on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Down on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Drag event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Drag Start event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Drag Stop event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Enter Event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Leave Event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Move on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Up on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Wheel event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Touch event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Touch Start event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Add event listener to Mouse Touch Stop event on Axis

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Subscribe onDispose event. This event is triggered whenever the Axis is disposed.

     // Example usage

    axis.onDispose(() => {
    console.log('axis was disposed')
    })

    axis.dispose()

    Returns

    Token of subscription

    Parameters

    • clbk: ((obj: Axis) => void)

      Event handler function

        • (obj: Axis): void
        • Parameters

          Returns void

    Returns Token

  • 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

    • listener: ((axis: Axis, start: number, end: number) => void)

      Event listener

        • (axis: Axis, start: number, end: number): void
        • Parameters

          • axis: Axis
          • start: number
          • end: number

          Returns void

    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

    • listener: ((obj: Axis, isStopped: boolean) => unknown)

      Event listener that is called when the event triggers.

        • (obj: Axis, isStopped: boolean): unknown
        • Parameters

          • obj: Axis
          • isStopped: boolean

          Returns unknown

    Returns Token

  • Register new event listener to visibleStateChanged event.

    Parameters

    • listener: VisibleStateChangedHandler<Axis>

      Event listener for visibleStateChanged

    Returns Token

  • Pan scale by pixel value delta.

    Used by ChartXY as well as Axis itself.

    Parameters

    • amount: number

      Amount to shift scale of axis in pixels

    Returns void

  • Set component highlight animations enabled or not. For most components this is enabled by default.

     // Example usage, disable highlight animations.
    component.setAnimationHighlight(false)

    Returns

    Object itself

    Parameters

    • enabled: boolean

      Animation enabled?

    Returns Axis

  • Specifies scroll animation.

    Parameters

    • enabled: undefined | boolean

      Boolean flag for whether scrolling should be animated or not.

    Returns Axis

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

  • Disable/Enable all animations of the Chart.

    Returns

    Axis itself for fluent interface.

    Parameters

    • animationsEnabled: boolean

      Boolean value to enable/disable animations.

    Returns Axis

  • Set is mouse-interaction enabled: Panning by dragging on axis. (RMB)

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Release axis by double-clicking on axis.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Zooming by dragging on axis. (LMB)

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Zooming by mouse-wheeling on axis.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set mouse style when hovering over axis area.

    Returns

    Object itself

    Parameters

    • mouseStyle: string = ...

      Mouse-style preset name (see MouseStyles)

    Returns Axis

  • Set mouse style when panning axis.

    Returns

    Object itself

    Parameters

    • mouseStyle: string = ...

      Mouse-style preset name (see MouseStyles)

    Returns Axis

  • Set mouse style when zooming axis.

    Returns

    Object itself

    Parameters

    • mouseStyle: string = ...

      Mouse-style preset name (see MouseStyles)

    Returns Axis

  • Set is mouse-interaction enabled: Fitting by capturing rectangle on chart.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Panning by dragging on chart.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Zooming by capturing rectangle on chart.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Zooming by mouse-wheeling on chart.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set all states of chart mouse interactions on axis at once.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • 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

    • opts: AxisIntervalConfiguration

      Parameters for axis interval.

    Returns Axis

  • Set enabled flags for all mouse-interactions on axis directly. Does not affect chart mouse-interactions.

    Returns

    Axis itself for fluent interface

    Parameters

    • enabled: boolean

      Boolean: are mouse-interactions enabled

    Returns Axis

  • Set is mouse-interaction enabled: Scaling by dragging on nib.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Set is mouse-interaction enabled: Scaling by mouse-wheeling on nib.

    Parameters

    • enabled: boolean

      Boolean flag

    Returns Axis

  • Specifies Axis nib stroke length in pixels

    Returns

    Axis itself for fluent interface

    Parameters

    • length: number

      Axis nib stroke length in pixels

    Returns Axis

  • Set mouse style when hovering over nib area.

    Returns

    Object itself

    Parameters

    • mouseStyle: string = ...

      Mouse-style preset name (see MouseStyles)

    Returns Axis

  • Set ideal size of nib mouse-picking area in pixels.

    Returns

    Object itself

    Parameters

    • size: number

      Size in pixels

    Returns Axis

  • Set mouse style when scaling nib.

    Returns

    Object itself

    Parameters

    • mouseStyle: string = ...

      Mouse-style preset name (see MouseStyles)

    Returns Axis

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

  • Set style of Axis line stroke.

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

    Supported fill styles:

    SolidFill:

    Solid fill color.

     // Example, solid colored line.
    Axis.setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new SolidFill({ color: ColorRGBA(255, 0, 0) })
    }))

    To learn more about available Color factories, see ColorRGBA

    PalettedFill:

    Color line stroke dynamically based on x or y coordinate.

     // Example, dynamic color by Y coordinates
    Axis.setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new PalettedFill({
    lookUpProperty: 'y',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 10, color: ColorRGBA(0, 255, 0) },
    ]
    })
    })
    }))

    To learn more about Color lookup tables, see LUT.

    LinearGradientFill:

    Color line stroke with a linear configurable gradient palette.

     // Example, linear gradient line color
    Axis.setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new LinearGradientFill()
    }))

    To learn more about linear gradient configurations, see LinearGradientFill.

    RadialGradientFill:

    Color line stroke with a radial configurable gradient palette.

     // Example, radial gradient line color
    Axis.setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new RadialGradientFill()
    }))

    To learn more about radial gradient configurations, see RadialGradientFill.

    Returns

    Object itself for fluent interface.

    Parameters

    Returns Axis

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

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

  • Specifies an Axis title string

    Returns

    Axis itself for fluent interface

    Parameters

    • title: string

      Axis title as a string

    Returns Axis

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

  • Specifies padding after Axis title. This is only accounted when title is visible.

    Returns

    Axis itself for fluent interface

    Parameters

    • margin: number

      Gap between the title and the next axis in pixels. Can also affect chart margins

    Returns Axis

  • Set rotation of Axis title.

    Returns

    Object itself

    Parameters

    • value: number

      Rotation in degrees

    Returns Axis

  • Set element visibility.

    Returns

    Object itself.

    Parameters

    • state: boolean

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

    Returns Axis

  • Zoom scale from/to a position.

    Used by ChartXY as well as Axis itself.

    Parameters

    • referencePosition: number

      Position to zoom towards or from on axis

    • zoomDirection: number

      Amount and direction of zoom [-1, 1] as a guideline

    Returns void