Series that can visualize any combination of Lines, Points and Area filling.

Also supports different preprocessing options (step/spline/disabled).

This series is a beta version with severe performance optimizations compared to old XY series. It is significantly more memory efficient and can handle much more data more efficiently than the old series versions.

It introduces drafts for new end user APIs for many purposes, like more logical automatic data cleaning configuration, modifying visualization type during run-time, etc.

For beta purposes, this is introduced as a separate series type. After official release, it will merge into the old APIs, like addLineSeries, addPointSeries, etc.

For more information and documentation, please see "XY features rework" in Developer Documentation. https://lightningchart.com/js-charts/docs/more-guides/beta-xy/

Creating PointLineAreaSeries:

PointLineAreaSeries are created with addPointLineAreaSeries method.

Some properties of PointLineAreaSeries can only be configured when it is created. These arguments are all optional, and are wrapped in a single object parameter:

 // Example,
const series = ChartXY.addPointLineAreaSeries({
// Specify non-default X Axis to attach series to.
xAxis: myNonDefaultAxisX
})

To learn about available properties, refer to PointLineAreaSeriesOptions.

Examples:

Different data visualizations can be achieved simply by changing the style of the series.

 // Area series
const series = ChartXY.addPointLineAreaSeries({ dataPattern: 'ProgressiveX' })
 // Point-Line series
const series = ChartXY.addPointLineAreaSeries({ dataPattern: 'ProgressiveX' })
.setAreaFillStyle(emptyFill)
 // Point series
const series = ChartXY.addPointLineAreaSeries({ dataPattern: null })
.setAreaFillStyle(emptyFill)
.setStrokeStyle(emptyLine)
 // Step series
const series = ChartXY.addPointLineAreaSeries({ dataPattern: 'ProgressiveX' })
.setAreaFillStyle(emptyFill)
.setCurvePreprocessing({ type: 'step', step: 'middle' })
 // Spline series
const series = ChartXY.addPointLineAreaSeries({ dataPattern: 'ProgressiveX' })
.setAreaFillStyle(emptyFill)
.setCurvePreprocessing({ type: 'spline' })
This feature is currently in public beta. It may change in near future or receive rapid patches according to user feedback and experiences.

Hierarchy

Implements

Properties

Accessors

Methods

add addArraysXY alterSamples alterSamplesByID appendJSON appendSample appendSamples attach clear dispose fill getAnimationHighlight getAreaFillStyle getAutoScrollingEnabled getBoundaries getClipping getCursorEnabled getCursorFormattingOverride getCurvePreprocessing getDataSet getEffect getHighlight getHighlightOnHover getIcon getIsUnderMouse getMaxSampleCount getMouseInteractions getName getNextSampleIndex getPointAlignment getPointFillStyle getPointRotation getPointShape getPointSize getSampleCount getStrokeStyle getVisible getXMax getXMin getYMax getYMin isDisposed offDispose offHighlight offMaxSampleCountExceeded offMouseClick offMouseDoubleClick offMouseDown offMouseDrag offMouseDragStart offMouseDragStop offMouseEnter offMouseLeave offMouseMove offMouseUp offMouseWheel offTouchEnd offTouchMove offTouchStart offVisibleStateChanged onDispose onHighlight onMaxSampleCountExceeded onMouseClick onMouseDoubleClick onMouseDown onMouseDrag onMouseDragStart onMouseDragStop onMouseEnter onMouseLeave onMouseMove onMouseUp onMouseWheel onTouchEnd onTouchMove onTouchStart onVisibleStateChanged readBack setAnimationHighlight setAreaFillStyle setAutoScrollingEnabled setClipping setCursorEnabled setCursorFormattingOverride setCurvePreprocessing setDataSet setDrawOrder setEffect setHighlight setHighlightOnHover setIcon setMaxSampleCount setMouseInteractions setName setPointAlignment setPointFillStyle setPointRotation setPointShape setPointSize setSamples setStrokeStyle setVisible solveNearest styleLegendEntry

Properties

_isCursorEnabled: boolean = true

Active state of Cursor

axisX: Axis
axisY: Axis
scale: LinearScaleXY | MixedScaleXY

Scale of the series

Accessors

  • get xAxis(): Axis
  • Returns Axis

  • get yAxis(): Axis
  • Returns Axis

Methods

  • Add data as { x: number, y: number } objects.

    This method exists only for backwards compatibility reasons. Using appendJSON is recommended instead.

    Returns

    Object itself.

    Deprecated

    Use appendJSON instead

    Parameters

    • data: {
          x: number;
          y: number;
      }[] | {
          x: number;
          y: number;
      }

    Returns PointLineAreaSeries

  • Add data as number[] number[]

    This method exists only for backwards compatibility reasons. Using appendSamplesXY is recommended instead.

    Returns

    Object itself.

    Deprecated

    Use appendSamplesXY instead

    Parameters

    • xArray: number[]
    • yArray: number[]

    Returns PointLineAreaSeries

  • Alter existing samples in the data set. This method also supports automatically appending samples when attempting to alter samples that don't exist in data set.

    This method alters existing samples by referencing sample indexes. This simply refers to a incrementing counter of when each sample was first introduced. For example, 0 refers to first sample that was added to data set. When data cleaning is enabled, sample indexes do NOT shift. They always point to unique samples, even if old samples are removed.

     // Example, basic usage - set first sample to { x: 0, y: 0 }
    DataSetXY.alterSamples(0, {
    xValues: [0],
    yValues: [1]
    })
     // Example, alter several samples at once - set first sample to { x: 0, y: 10 }, second sample to { x: 1, y: 11 } and so on.
    DataSetXY.alterSamples(0, {
    xValues: [0, 1, 2],
    yValues: [10, 11, 12]
    })
     // Example, alter last sample to have Y = 0.
    DataSetXY.alterSamples(DataSetXY.getNextSampleIndex() - 1, {
    yValues: [0]
    })

    See also alterSamplesByID.

    Returns

    Object itself.

    Parameters

    • iSampleMin: number

      First altered sample index.

    • values: {
          colors?: number[] | Uint32Array | Color[];
          count?: number;
          ids?: number[] | Uint32Array;
          lookupValues?: number[] | Float32Array;
          offset?: number;
          offsetColors?: number;
          offsetIds?: number;
          offsetLookupValues?: number;
          offsetRotations?: number;
          offsetSizes?: number;
          rotations?: number[] | Float32Array;
          sizes?: number[] | Float32Array;
          x?: number;
          xValues?: number[] | TypedArray;
          y?: number;
          yValues?: number[] | TypedArray;
      }

      Object with new sample values. Behaves same as appendSamples.

      • Optional colors?: number[] | Uint32Array | Color[]
      • Optional count?: number
      • Optional ids?: number[] | Uint32Array
      • Optional lookupValues?: number[] | Float32Array
      • Optional offset?: number
      • Optional offsetColors?: number
      • Optional offsetIds?: number
      • Optional offsetLookupValues?: number
      • Optional offsetRotations?: number
      • Optional offsetSizes?: number
      • Optional rotations?: number[] | Float32Array
      • Optional sizes?: number[] | Float32Array
      • Optional x?: number
      • Optional xValues?: number[] | TypedArray
      • Optional y?: number
      • Optional yValues?: number[] | TypedArray

    Returns PointLineAreaSeries

  • Alter existing samples in the data set.

    This method alters existing samples by referencing their ID properties. The ID property is an optional sample number property, which CAN be specified by the user. They have to be enabled using ids and afterwards can be added alongside other data properties, like x, y, etc.

     // Example, basic usage
    const dataSet = new DataSetXY({ ids: true })
    dataSet.appendSamples({
    ids: [0, 1, 2],
    yValues: [10, 12, 7],
    })
    dataSet.alterSamplesByID([1], {
    yValues: [20]
    })
    // result yValues = [10, 20, 7]
     // Example, apply same value to all altered samples
    dataSet.alterSamplesByID([0, 1, 2], { size: 5 })

    See also alterSamples.

    Returns

    Object itself.

    Parameters

    • ids: number[] | Uint32Array

      List of sample IDs that are altered.

    • values: {
          color?: number | Color;
          colors?: number[] | Uint32Array | Color[];
          lookupValue?: number;
          lookupValues?: number[] | TypedArray;
          rotation?: number;
          rotations?: number[] | Float32Array;
          size?: number;
          sizes?: number[] | Float32Array;
          x?: number;
          xValues?: number[] | TypedArray;
          y?: number;
          yValues?: number[] | TypedArray;
      }

      Object with new sample values. Behaves same as appendSamples.

      • Optional color?: number | Color
      • Optional colors?: number[] | Uint32Array | Color[]
      • Optional lookupValue?: number
      • Optional lookupValues?: number[] | TypedArray
      • Optional rotation?: number
      • Optional rotations?: number[] | Float32Array
      • Optional size?: number
      • Optional sizes?: number[] | Float32Array
      • Optional x?: number
      • Optional xValues?: number[] | TypedArray
      • Optional y?: number
      • Optional yValues?: number[] | TypedArray

    Returns PointLineAreaSeries

  • Add several samples from JSON by reading values from instructed property names.

     // Example, read x + y
    const arr = [{ x: 0, y: 0 }]
    DataSetXY.appendJSON(arr, { x: 'x', y: 'y' })
     // Example, read custom property names
    const arr = [{ timestamp: 0, voltage: 0 }]
    DataSetXY.appendJSON(arr, { x: 'timestamp', y: 'voltage' })
     // Example, only Y values
    const arr = [{ price: 0 }]
    DataSetXY.appendJSON(arr, { y: 'price' })
     // Example, color values
    const arr = [{ x: 0, y: 0, color: 0xff0000ff }]
    DataSetXY.appendJSON(arr, { x: 'x', y: 'y', color: 'color' })

    Please note that before adding optional values (lookup values, ids or colors), they need to be enabled using colors or equivalent!

    Supported sample property types:

    • x: number, Date object or Date time string
    • y: number, Date object or Date time string
    • lookupValue: number
    • id: number
    • color: either Color object or number which represents a Uint32 RGBA color with Red channel being least significant byte. Note that using Color objects in large quantities should be avoided for performance reasons.

    Returns

    Object itself.

    Type Parameters

    • T extends {
          [key: string]: number | Date | string;
      }

    Parameters

    • array: T[]

      Array with JSON objects which represent samples.

    • Optional arg: {
          color?: keyof T;
          id?: keyof T;
          lookupValue?: keyof T;
          rotation?: keyof T;
          size?: keyof T;
          start?: number;
          step?: number;
          x?: keyof T;
          y?: keyof T;
      }

      Object which informs which property names contain data. At least x or y property should always be specified.

      • Optional color?: keyof T
      • Optional id?: keyof T
      • Optional lookupValue?: keyof T
      • Optional rotation?: keyof T
      • Optional size?: keyof T
      • Optional start?: number
      • Optional step?: number
      • Optional x?: keyof T
      • Optional y?: keyof T

    Returns PointLineAreaSeries

  • Add 1 sample to data set.

     // Example, basic usage
    DataSetXY.appendSample({ x: 0, y: 0 })
     // Example, only Y value with automatic X step
    DataSetXY.appendSample({ y: 0, step: 1 })
     // Example, extra properties (color)
    DataSetXY.appendSample({ x: 0, y: 0, color: 0xff0000ff })

    Please note that before adding optional values (lookup values, ids or colors), they need to be enabled using colors or equivalent!

    Supported sample property types:

    • x: number, Date object or Date time string
    • y: number, Date object or Date time string
    • lookupValue: number
    • id: number
    • size: number
    • rotation: number
    • color: either Color object or number which represents a Uint32 RGBA color with Red channel being least significant byte. Note that using Color objects in large quantities should be avoided for performance reasons.

    Returns

    Object itself.

    Parameters

    • arg: {
          color?: number | Color;
          id?: number;
          lookupValue?: number;
          rotation?: number;
          size?: number;
          step?: number;
          x?: string | number | Date;
          y?: string | number | Date;
      }

      Object any data properties (x, y, lookupValue, color, id, size, rotation).

      • Optional color?: number | Color
      • Optional id?: number
      • Optional lookupValue?: number
      • Optional rotation?: number
      • Optional size?: number
      • Optional step?: number
      • Optional x?: string | number | Date
      • Optional y?: string | number | Date

    Returns PointLineAreaSeries

  • Add a list of samples to data set.

     // Example, basic usage.
    DataSetXY.appendSamples({
    xValues: [0, 1, 2],
    yValues: [100, 101, 102],
    })
     // Example, only Y values with automatic X step
    DataSetXY.appendSamples({
    yValues: [100, 101, 102],
    start: 0,
    step: 1,
    })
     // Example, typed array input.
    DataSetXY.appendSamples({
    yValues: new Float32Array([100, 101, 102]),
    })
     // Example, extra properties (color)
    DataSetXY.appendSamples({
    xValues: [0, 1, 2],
    yValues: [100, 101, 102],
    colors: [0xff0000ff, 0xff00ff00, 0xffff0000]
    })

    Please note that before adding optional values (lookup values, ids or colors), they need to be enabled using colors or equivalent!

    Supported sample property types:

    • x: number, Date object or Date time string
    • y: number, Date object or Date time string
    • lookupValue: number
    • id: number
    • size: number
    • rotation: number
    • color: either Color object or number which represents a Uint32 RGBA color with Red channel being least significant byte. Note that using Color objects in large quantities should be avoided for performance reasons.

    offset properties can optionally be used to start reading values from middle of input array. Can be situationally useful.

    Returns

    Object itself.

    Parameters

    • arg: {
          colors?: number[] | Uint32Array | Color[];
          count?: number;
          ids?: number[] | Uint32Array;
          lookupValues?: number[] | Float32Array;
          offset?: number;
          offsetColors?: number;
          offsetIds?: number;
          offsetLookupValues?: number;
          offsetRotations?: number;
          offsetSizes?: number;
          rotations?: number[] | Float32Array;
          sizes?: number[] | Float32Array;
          start?: number;
          step?: number;
          xValues?: string[] | number[] | TypedArray | Date[];
          yValues?: string[] | number[] | TypedArray | Date[];
      }

      Object with data properties and optional behavior configurations.

      • Optional colors?: number[] | Uint32Array | Color[]
      • Optional count?: number
      • Optional ids?: number[] | Uint32Array
      • Optional lookupValues?: number[] | Float32Array
      • Optional offset?: number
      • Optional offsetColors?: number
      • Optional offsetIds?: number
      • Optional offsetLookupValues?: number
      • Optional offsetRotations?: number
      • Optional offsetSizes?: number
      • Optional rotations?: number[] | Float32Array
      • Optional sizes?: number[] | Float32Array
      • Optional start?: number
      • Optional step?: number
      • Optional xValues?: string[] | number[] | TypedArray | Date[]
      • Optional yValues?: string[] | number[] | TypedArray | Date[]

    Returns PointLineAreaSeries

  • Attach object to an legendBox entry

    Returns

    Series itself for fluent interface

    Parameters

    • entry: LegendBoxEntry<UIBackground>

      Object which has to be attached

    • toggleVisibilityOnClick: boolean = true

      Flag that indicates whether the Attachable should be hidden or not, when its respective Entry is clicked.

    • matchStyleExactly: boolean = false

      By default, entries are assigned a smooth looking gradient based on the component color. If this flag is true, then this is skipped, and exact component solid fill is used instead.

    Returns PointLineAreaSeries

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

  • Load same value or many values to all samples that currently exist in the data set.

     // Example, set point size of all samples to 5 pixels
    DataSetXY.fill({ size: 5 })

    Returns

    Object itself.

    Parameters

    • arg: {
          color?: number | Color;
          lookupValue?: number;
          rotation?: number;
          size?: number;
          x?: number;
          y?: number;
      }

      Object with data properties.

      • Optional color?: number | Color
      • Optional lookupValue?: number
      • Optional rotation?: number
      • Optional size?: number
      • Optional x?: number
      • Optional y?: number

    Returns PointLineAreaSeries

  • Get component highlight animations enabled or not.

    Returns

    Animation enabled?

    Returns boolean

  • Get current area fill style.

    Returns

    FillStyle object.

    Returns FillStyle

  • Get whether series is taken into account with automatic scrolling and fitting of attached axes.

    By default, this is true for all series.

    Returns

    true default, axes will take series into account in scrolling and fitting operations. false, axes will ignore series boundaries.

    Returns boolean

  • Read whether series rendering should be clipped to the area enclosed by its owning axes or not. All series rendering is ALWAYS clipped so that it doesn't leak outside the owning charts series area. However, it is optional whether the series rendering should be able to leak outside the series owning axes viewport, which might be smaller than the charts viewport (for example, when using stacked axes).

    By default, clipping is enabled (true).

    Returns

    True or false.

    Returns boolean

  • Returns

    Whether Cursor is enabled or not

    Returns boolean

  • 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 state of component highlighting.

    In case highlight animations are enabled, this method returns the unanimated highlight value.

    Returns

    Number between 0 and 1, where 1 is fully highlighted.

    Returns number

  • Get boolean flag for whether object should highlight on mouse hover

    Returns

    Boolean for if object should highlight on mouse hover or not.

    Returns boolean

  • Beta

    Set icon of the chart component. This is displayed in legends and by default cursor formatters.

    Returns

    Icon object or undefined. Released as beta feature in v5.2.0 feature may still change according to user feedback and experiences.

    Returns undefined | Icon

  • Get boolean flag for whether object is currently under mouse or not

    Returns

    Boolean for is object under mouse currently

    Returns boolean

  • Get current configured maximum sample count. See setMaxSampleCount for more information.

    Returns

    Number of undefined.

    Returns undefined | number

  • Get mouse interactions enabled or disabled. Disabled mouse-interactions will naturally prevent mouse-driven highlighting from ever happening.

    Returns

    Mouse interactions state

    Returns boolean

  • Get the name of the Component.

    Returns

    The name of the Component.

    Returns string

  • Get next new sample index. This also counts old samples that have been dropped out by data cleaning logic.

    Returns

    Number.

    Returns number

  • Beta

    Get alignment of points. Defaults to center { x: 0, y: 0 }.

    Can be used to offset points relative to their size.

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

    Returns Point

  • Get current markers fill style.

    Returns

    FillStyle object.

    Returns FillStyle

  • Get the current rotation of points as degrees.

    Returns number

  • Get current size of points in pixels.

    Returns

    Size of point in pixels.

    Returns number

  • Get number of samples currently existing in the data set. This does NOT count any samples that have been dropped out by data cleaning logic.

    Returns

    Number.

    Returns number

  • Get stroke style of Series.

    Returns

    LineStyle object

    Returns LineStyle

  • Get element visibility.

    Returns

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

    Returns boolean

  • Returns

    Max X value of the series

    Returns undefined | number

  • Returns

    Min X value of the series

    Returns undefined | number

  • Returns

    Max Y value of the series

    Returns undefined | number

  • Returns

    Min Y value of the series

    Returns undefined | number

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

    Returns

    true if object is disposed.

    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

  • Unsubscribe from Highlight object event. This is called whenever an object is highlighted

    Returns

    True if the unsubscription was successful.

    Parameters

    • token: Token

      Token that was received when subscribing to the event.

    Returns boolean

  • Unsubscribe from event when configured max sample count is exceeded.

     // Example
    const token = DataSetXY.onMaxSampleCountExceeded((dataSet, currentSampleCount, currentMaxSampleCount, newTotalSampleCount) => {})
    DataSetXY.offMaxSampleCountExceeded(token)

    Parameters

    • token: Token

      Token received from subscribing to corresponding event.

    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 Touch End 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 Touch 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 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 visibleStateChanged

    Parameters

    • token: Token

    Returns boolean

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

     // Example usage

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

    lineSeries.dispose()

    Returns

    Token of subscription

    Parameters

    Returns Token

  • Subscribe to highlight object event. This is called whenever an object is highlighted.

    Returns

    Token that can be used to unsubscribe from the event.

    Parameters

    Returns Token

  • Subscribe to event when configured max sample count is exceeded. This can be used to add custom logic to increase max sample count or not.

     DataSetXY.onMaxSampleCountExceeded((dataSet, currentSampleCount, currentMaxSampleCount, newTotalSampleCount) => {
    // Example, double max sample count
    dataSet.setMaxSampleCount(Math.max(currentMaxSampleCount * 2, newTotalSampleCount))
    })

    Returns

    Token that can be used to unsubscribe from event.

    Parameters

    • clbk: ((dataSet: DataSetXY, currentSampleCount: number, currentMaxSampleCount: number, newTotalSampleCount: number) => unknown)

      Function that is triggered on event.

        • (dataSet: DataSetXY, currentSampleCount: number, currentMaxSampleCount: number, newTotalSampleCount: number): unknown
        • Parameters

          • dataSet: DataSetXY
          • currentSampleCount: number
          • currentMaxSampleCount: number
          • newTotalSampleCount: number

          Returns unknown

    Returns Token

  • Add event listener to Mouse Click Event

    Returns

    Token of the event listener

    Parameters

    • clbk: MouseEventHandler<this, SolveResultType>

      Event listener for Mouse Click Event

    Returns Token

  • Add event listener to Mouse Double Click Event

    Returns

    Token of the event listener

    Parameters

    • clbk: MouseEventHandler<this, SolveResultType>

      Event listener for Mouse Double Click Event

    Returns Token

  • Add event listener to Mouse Down Event

    Returns

    Token of the event listener

    Parameters

    Returns Token

  • Add event listener to Enter Event

    Returns

    Token of the event listener

    Parameters

    • clbk: MouseEventHandler<this, SolveResultType>

      Event listener for Mouse Enter Event

    Returns Token

  • Add event listener to Mouse Move Event

    Returns

    Token of the event listener

    Parameters

    Returns Token

  • Add event listener to Mouse Up Event

    Returns

    Token of the event listener

    Parameters

    Returns Token

  • Read back the current contents of the data set.

     // Read back data
    const data = DataSetXY.readBack()
    console.log(data)

    If data cleaning (max sample count) is enabled, this can result in allocating new memory (and thus be expensive). Otherwise, a very efficient operation.

    The returned values should NOT be modified.

    Optionally, you can include the flag onlyInRange to find return only samples that are in specified range. This is only supported if the data set has a "data pattern" (e.g. { dataPattern: 'ProgressiveX' }). The range is always considered to be in the same dimension as this data pattern (e.g. X Axis).

     // Example, read back data that is visible
    ChartXY.getDefaultAxisX().onIntervalChange((axis, start, end) => {
    const data = DataSetXY.readBack({ onlyInRange: { start, end } })
    console.log(data)
    })

    This operation is not "pixel perfect", meaning it can often return 1 extra sample that is not visible (the next and/or previous ones).

    Returns

    Object with lists of separate data channels, like x coordinates, y coordinates, look up values, colors, etc.

    Parameters

    • Optional arg: {
          onlyInRange?: {
              end: number;
              start: number;
          };
      }
      • Optional onlyInRange?: {
            end: number;
            start: number;
        }
        • end: number
        • start: number

    Returns {
        colors?: Uint32Array;
        iSampleFirst: number;
        ids?: Uint32Array;
        lookupValues?: Float32Array;
        rotations?: Float32Array;
        sizes?: Float32Array;
        xValues: TypedArray;
        yValues: TypedArray;
    }

    • Optional colors?: Uint32Array
    • iSampleFirst: number
    • Optional ids?: Uint32Array
    • Optional lookupValues?: Float32Array
    • Optional rotations?: Float32Array
    • Optional sizes?: Float32Array
    • xValues: TypedArray
    • yValues: TypedArray
  • 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 PointLineAreaSeries

  • Set fill style of area under the series trend.

    Supported fill styles:

    SolidFill:

    Solid color for entire area fill.

     // Example, solid colored area fill.
    PointLineAreaSeries.setAreaFillStyle(new SolidFill({ color: ColorRGBA(255, 0, 0) }))

    To learn more about available Color factories, see ColorRGBA

    PalettedFill:

    Supports following look-up modes: x, y and value.

    lookUpProperty: 'x' | 'y':

    Color dynamically based on x or y coordinate.

     // Example, dynamic color by Y coordinates
    PointLineAreaSeries.setAreaFillStyle(new PalettedFill({
    lookUpProperty: 'y',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 100, color: ColorRGBA(0, 255, 0) },
    ]
    })
    }))

    To learn more about Color lookup tables, see LUT.

    lookUpProperty: 'value':

    Color dynamically based on separately supplied value data set. values are specified when adding data points.

     // Example, dynamic color by Value data set
    const series = ChartXY.addPointLineAreaSeries({ lookupValues: true })
    .setAreaFillStyle(new PalettedFill({
    lookUpProperty: 'value',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 100, color: ColorRGBA(0, 255, 0) },
    ]
    })
    }))
    .appendSamples({
    yValues: [0, 1],
    lookupValues: [0, 100]
    })

    Data point lookup value properties have to be explicitly enabled before they can be used, see lookupValues for more details.

    To learn more about Color lookup tables, see LUT.

    IndividualPointFill:

    Color area fill with individually picked sample colors. Colors are interpolated between data points.

     // Example, individual colors
    const series = ChartXY.addPointLineAreaSeries({ colors: true })
    .setAreaFillStyle(new IndividualPointFill())
    .appendSamples({
    yValues: [0, 1],
    colors: [0xff0000ff, 0xff00ff00]
    })

    Data point color properties have to be explicitly enabled before they can be used, see colors for more details.

    LinearGradientFill:

    Color area fill with a linear gradient.

     // Example, linear gradient area fill
    PointLineAreaSeries.setAreaFillStyle(new LinearGradientFill())

    To learn more about linear gradient configurations, see LinearGradientFill.

    RadialGradientFill:

    Color area fill with a radial gradient.

     // Example, radial gradient line color
    PointLineAreaSeries.setAreaFillStyle(new RadialGradientFill())

    To learn more about radial gradient configurations, see RadialGradientFill.

    Returns

    Object itself for fluent interface.

    Parameters

    Returns PointLineAreaSeries

  • Set whether series is taken into account with automatic scrolling and fitting of attached axes.

    By default, this is true for all series.

    By setting this to false, any series can be removed from axis scrolling/fitting.

     // Example syntax, remove series from automatic scrolling / fitting.
    LineSeries.setAutoScrollingEnabled(false)

    Returns

    Object itself for fluent interface.

    Parameters

    • enabled: boolean

      true default, axes will take series into account in scrolling and fitting operations. false, axes will ignore series boundaries.

    Returns PointLineAreaSeries

  • Configure whether series rendering should be clipped to the area enclosed by its owning axes or not. All series rendering is ALWAYS clipped so that it doesn't leak outside the owning charts series area. However, it is optional whether the series rendering should be able to leak outside the series owning axes viewport, which might be smaller than the charts viewport (for example, when using stacked axes).

    By default, clipping is enabled (true).

     // Example, disable clipping, allowing the series rendering to leak outside its own axes.
    SeriesXY.setClipping(false)

    Returns

    Object itself

    Parameters

    • clipping: boolean

      Clipping enabled or disabled.

    Returns PointLineAreaSeries

  • Configure whether cursors should pick on this particular series or not.

     // Example, prevent chart auto cursor from snapping to a series.
    LineSeries.setCursorEnabled(false)

    Related API:

    • setCursorMode | configure behavior when auto cursor is visible.

    Parameters

    • state: boolean

    Returns PointLineAreaSeries

  • Beta

    Set override behavior for when this series is formatted to be displayed by a cursor. This can be used to alter and expand on cursor formatting done for a specific series, either by the library's default cursor formatters or even the users own cursor formatters defined on chart level.

     // Example syntax, add extra row to display a custom data property
    series.setCursorFormattingOverride((hit, before) => {
    if (!isHitSampleXY(hit)) return before
    const customPropertyValue = data[hit.iSample].customProperty
    return [...before, ['ASD', '', customPropertyValue.toFixed(3)]]
    })

    To use this with users own cursor formatters, you can use useCursorFormatterSeriesOverride:

     // Example syntax, define custom cursor formatting with support for series overrides
    chart.setCursorFormatting((_, __, hits) => {
    return [
    [hits[0].axisX.formatValue(hits[0].x)],
    ...hits.map((hit) => useCursorFormatterSeriesOverride(hit, [['Y:', '', hit.axisY.formatValue(hit.y)]])).flat(),
    ]
    })

    Returns

    Object itself.

    Introduced in v6.0.0, the state and definition of this API is not finalized. It may change in future versions without regard to backwards compatibility if there is significant cause from user feedback.
    

    Parameters

    Returns PointLineAreaSeries

  • Set data set which the series visualizes. This can be changed at any point.

    If data set is not set using this method, then the series creates it automatically as soon as data is pushed in.

     // Example
    const dataSet = new DataSetXY()
    PointLineAreaSeries.setDataSet(dataSet)

    Parameters

    Returns PointLineAreaSeries

  • Configure draw order of the series.

    The drawing order of series inside same chart can be configured by configuring their seriesDrawOrderIndex. This is a simple number that indicates which series is drawn first, and which last.

    The values can be any JS number, even a decimal. Higher number results in series being drawn closer to the top.

    By default, each series is assigned a running counter starting from 0 and increasing by 1 for each series.

        // Example, create 2 series and configure them to be drawn in reverse order.
    const series1 = ChartXY.addLineSeries()
    .setDrawOrder({ seriesDrawOrderIndex: 1 })
    const series2 = ChartXY.addLineSeries()
    .setDrawOrder({ seriesDrawOrderIndex: 0 })
        // Example, ensure a series is drawn above other series.
    SeriesXY.setDrawOrder({ seriesDrawOrderIndex: 1000 })

    Returns

    Object itself.

    Parameters

    • arg: {
          seriesDrawOrderIndex: number;
      }

      Object with seriesDrawOrderIndex property.

      • seriesDrawOrderIndex: number

    Returns PointLineAreaSeries

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

  • Set state of component highlighting.

     // Example usage

    component.setHighlight(true)

    component.setHighlight(0.5)

    If highlight animations are enabled (which is true by default), the transition will be animated. As long as the component is highlighted, the active highlight intensity will be animated continuously between 0 and the configured value. Highlight animations can be disabled with setAnimationHighlight

    Returns

    Object itself

    Parameters

    • highlight: number | boolean

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

    Returns PointLineAreaSeries

  • Set highlight on mouse hover enabled or disabled.

    Mouse interactions have to be enabled on the component for this to function as expected. See setMouseInteractions for more information.

    Returns

    Object itself for fluent interface.

    Parameters

    • state: boolean

      True if highlighting on mouse hover, false if no highlight on mouse hover

    Returns PointLineAreaSeries

  • Beta

    Set icon of the chart component. This is displayed in legends and by default cursor formatters.

     const image = new Image()
    image.src = 'image.png'
    const icon = chart.engine.addCustomIcon(image)
    ChartComponent.setIcon(icon)

    Returns

    Object itself.

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

    Parameters

    • icon: undefined | Icon

      Icon

    Returns PointLineAreaSeries

  • All real-time use cases (where data points are pushed in periodically) must define a "max sample count".

     // Example, keep maximum 1 million samples
    PointLineAreaSeries.setMaxSampleCount(1_000_000)

    This allocates the required amount of memory beforehand, which is crucial to get the best performance. After 1 million samples are reached, the oldest samples will start dropping out.

    Alternatively, if you are uncertain what value to use and don't want to allocate too much memory up-front, you can start small and automatically increase the buffer size as samples flow in:

     PointLineAreaSeries.setMaxSampleCount({ mode: 'auto', max: 10_000_000 })
    

    This would first allocate only small amount of memory, progressively increase memory allocation as samples come in until eventually limiting sample count to 10 million.

    Returns

    Object itself.

    Parameters

    • maxSampleCount: number

      Max sample count.

    Returns PointLineAreaSeries

  • All real-time use cases (where data points are pushed in periodically) must define a "max sample count".

     // Example, keep maximum 1 million samples
    PointLineAreaSeries.setMaxSampleCount(1_000_000)

    This allocates the required amount of memory beforehand, which is crucial to get the best performance. After 1 million samples are reached, the oldest samples will start dropping out.

    Alternatively, if you are uncertain what value to use and don't want to allocate too much memory up-front, you can start small and automatically increase the buffer size as samples flow in:

     PointLineAreaSeries.setMaxSampleCount({ mode: 'auto', max: 10_000_000 })
    

    This would first allocate only small amount of memory, progressively increase memory allocation as samples come in until eventually limiting sample count to 10 million.

    Returns

    Object itself.

    Parameters

    • arg: {
          initial?: number;
          max?: number;
          mode: "auto";
      }
      • Optional initial?: number
      • Optional max?: number
      • mode: "auto"

    Returns PointLineAreaSeries

  • Set component mouse interactions enabled or disabled.

    Disabling mouse interactions means that the objects below this component can be interacted through it.

    Possible side-effects from disabling mouse interactions:

    • Mouse events are not triggered. For example, onMouseMove.
    • Mouse driven highlighting will not work.

    Returns

    Object itself for fluent interface

    Parameters

    • state: boolean

      Specifies state of mouse interactions

    Returns PointLineAreaSeries

  • Beta

    Set alignment of points. Defaults to center { x: 0, y: 0 }.

    Can be used to offset points relative to their size.

     // Example, position point by bottom
    PointLineAreaSeries.setPointAlignment({ x: 0, y: -1 })
     // Example, position point by bottom with extra gap
    PointLineAreaSeries.setPointAlignment({ x: 0, y: -1.5 })

    Returns

    Object itself.

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

    Parameters

    • alignment: Point

      Alignment where values are % in range [-1, 1]. Can also be larger values, meaning offsets larger than point size.

    Returns PointLineAreaSeries

  • Set fill style of markers displayed at sample locations.

    Supported fill styles:

    SolidFill:

    Solid color.

     // Example, solid colored markers
    PointLineAreaSeries.setPointFillStyle(new SolidFill({ color: ColorRGBA(255, 0, 0) }))

    To learn more about available Color factories, see ColorRGBA

    PalettedFill:

    Supports following look-up modes: x, y and value.

    lookUpProperty: 'x' | 'y':

    Color dynamically based on x or y coordinate.

     // Example, dynamic color by Y coordinates
    PointLineAreaSeries.setPointFillStyle(new PalettedFill({
    lookUpProperty: 'y',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 100, color: ColorRGBA(0, 255, 0) },
    ]
    })
    }))

    To learn more about Color lookup tables, see LUT.

    lookUpProperty: 'value':

    Color dynamically based on separately supplied value data set. values are specified when adding data points.

     // Example, dynamic color by Value data set
    const series = ChartXY.addPointLineAreaSeries({ lookupValues: true })
    .setPointFillStyle(new PalettedFill({
    lookUpProperty: 'value',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 100, color: ColorRGBA(0, 255, 0) },
    ]
    })
    }))
    .appendSamples({
    yValues: [0, 1],
    lookupValues: [0, 100]
    })

    Data point lookup value properties have to be explicitly enabled before they can be used, see lookupValues for more details.

    To learn more about Color lookup tables, see LUT.

    IndividualPointFill:

    Color by individually picked sample colors. Colors are interpolated between data points.

     // Example, individual colors
    const series = ChartXY.addPointLineAreaSeries({ colors: true })
    .setPointFillStyle(new IndividualPointFill())
    .appendSamples({
    yValues: [0, 1],
    colors: [0xff0000ff, 0xff00ff00]
    })

    Data point color properties have to be explicitly enabled before they can be used, see colors for more details.

    ImageFill (beta feature, introduced in v5.2.0):

    Display custom images.

     // Example syntax
    const image = new Image()
    image.src = 'my-asset.png'

    const pointSeries = chart.addPointLineAreaSeries({ dataPattern: null })
    .setAreaFillStyle(emptyFill)
    .setStrokeStyle(emptyLine)
    .setPointFillStyle(new ImageFill({ source: image }))
    .appendSample({ x: 0, y: 0 })

    Please note that when ImageFill is used, Point line area series behaves a little bit differently:

    1. Different point shapes are not available. Point shape should always be PointShape.Square
    2. Point size is interpreted as multiplier of source Image size. Defaults to 1.

    LinearGradientFill:

    Color with a linear gradient.

     // Example, linear gradient area fill
    PointLineAreaSeries.setPointFillStyle(new LinearGradientFill())

    To learn more about linear gradient configurations, see LinearGradientFill.

    RadialGradientFill:

    Color with a radial gradient.

     // Example, radial gradient line color
    PointLineAreaSeries.setPointFillStyle(new RadialGradientFill())

    To learn more about radial gradient configurations, see RadialGradientFill.

    Returns

    Object itself for fluent interface.

    Parameters

    Returns PointLineAreaSeries

  • Set the rotation of points in degrees.

     // Example syntax, rotate 45 degrees
    PointLineAreaSeries.setPointRotation(45)

    Point rotations can also be configured individually, see DataSetXY.rotations for more information.

    Parameters

    • angle: number

      Rotation angle in degrees

    Returns PointLineAreaSeries

  • Set shape of displayed points, markers.

     // Example syntax
    PointLineAreaSeries.setPointShape(PointShape.Square)

    All valid options are listed under PointShape

    Returns

    Object itself for fluent interface.

    Parameters

    Returns PointLineAreaSeries

  • Beta

    Set shape of displayed points as a Custom Icon. This allows using any custom bitmap as the shape of displayed points.

     // Example usage
    const image = new Image()
    image.src = 'my-image.png'
    PointLineAreaSeries.setPointShape(chart.engine.addCustomIcon(image))

    Returns

    Object itself for fluent interface. Released as beta feature in v5.2.0 feature may still change according to user feedback and experiences.

    Parameters

    • shape: Icon

      Icon object.

    Returns PointLineAreaSeries

  • Set size of point in pixels.

    Point sizes can also be configured individually, see DataSetXY.sizes for more information.

    Returns

    Object itself for fluent interface.

    Parameters

    • size: number

      Size of point in pixels.

    Returns PointLineAreaSeries

  • Re-specify all values in the data set. This is a convenience method that is fundamentally equal to:

     DataSetXY.clear().appendSamples({ ... })
    

    There are currently no performance differences between using "setSamples" versus "clear + append". However, in future it is possible that setSamples can receive optimizations which would make it recommended over "clear + append". In the mean-time, setSamples is recommended for simplicity and clarity in end user applications.

    For parameters documentation, refer to appendSamples method.

    Returns

    Object itself.

    Parameters

    • arg: {
          colors?: number[] | Uint32Array | Color[];
          count?: number;
          ids?: number[] | Uint32Array;
          lookupValues?: number[] | Float32Array;
          offset?: number;
          offsetColors?: number;
          offsetIds?: number;
          offsetLookupValues?: number;
          offsetRotations?: number;
          offsetSizes?: number;
          rotations?: number[] | Float32Array;
          sizes?: number[] | Float32Array;
          start?: number;
          step?: number;
          xValues?: string[] | number[] | TypedArray | Date[];
          yValues?: string[] | number[] | TypedArray | Date[];
      }

      Object with data properties and optional behavior configurations.

      • Optional colors?: number[] | Uint32Array | Color[]
      • Optional count?: number
      • Optional ids?: number[] | Uint32Array
      • Optional lookupValues?: number[] | Float32Array
      • Optional offset?: number
      • Optional offsetColors?: number
      • Optional offsetIds?: number
      • Optional offsetLookupValues?: number
      • Optional offsetRotations?: number
      • Optional offsetSizes?: number
      • Optional rotations?: number[] | Float32Array
      • Optional sizes?: number[] | Float32Array
      • Optional start?: number
      • Optional step?: number
      • Optional xValues?: string[] | number[] | TypedArray | Date[]
      • Optional yValues?: string[] | number[] | TypedArray | Date[]

    Returns PointLineAreaSeries

  • Set stroke style of Series.

    Supported line styles:

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

    Use -1 thickness to enable primitive line rendering. Primitive line rendering can have slightly better rendering performance than line with 1 thickness but the quality of line is not as good.

     PointLineAreaSeries.setStrokeStyle((stroke) => stroke.setThickness(-1))
    

    Supported fill styles:

    SolidFill:

    Solid color for entire line series.

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

    To learn more about available Color factories, see ColorRGBA

    PalettedFill:

    Line series supports following look-up modes: x, y and value.

    lookUpProperty: 'x' | 'y':

    Color line stroke dynamically based on x or y coordinate.

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

    To learn more about Color lookup tables, see LUT.

    lookUpProperty: 'value':

    Color line stroke dynamically based on separately supplied value data set. values are specified when adding data points.

     // Example, dynamic color by Value data set
    const series = ChartXY.addPointLineAreaSeries({ lookupValues: true })
    .setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new PalettedFill({
    lookUpProperty: 'value',
    lut: new LUT({
    interpolate: true,
    steps: [
    { value: 0, color: ColorRGBA(255, 0, 0) },
    { value: 100, color: ColorRGBA(0, 255, 0) },
    ]
    })
    })
    }))
    .appendSamples({
    yValues: [0, 1],
    lookupValues: [0, 100]
    })

    Data point lookup value properties have to be explicitly enabled before they can be used, see lookupValues for more details.

    To learn more about Color lookup tables, see LUT.

    IndividualPointFill:

    Color line stroke with individually picked sample colors. Line segment colors are interpolated between data points.

     // Example, individual colors
    const series = ChartXY.addPointLineAreaSeries({ colors: true })
    .appendSamples({
    yValues: [0, 1],
    colors: [0xff0000ff, 0xff00ff00]
    })
    .setStrokeStyle(new SolidLine({
    thickness: 2,
    fillStyle: new IndividualPointFill()
    }))

    Data point color properties have to be explicitly enabled before they can be used, see colors for more details.

    LinearGradientFill:

    Color line stroke with a linear configurable gradient palette.

     // Example, linear gradient line color
    PointLineAreaSeries.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
    PointLineAreaSeries.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 PointLineAreaSeries

  • Method for solving the nearest data point to a given coordinate on screen.

     // Example syntax
    chart.onSeriesBackgroundMouseClick((_, event) => {
    const nearest = series.solveNearest(event, 'show-nearest')
    console.log(nearest)
    })

    Returns

    SolveResult object or undefined.

    Parameters

    • from: CoordinateClient

      Reference coordinate on web page as client coordinates. This can for example be directly an Event object.

    • solveMode: SolveNearestMode = ...

      Optional control for solve nearest behavior

    Returns undefined | SolveResultSampleXY

  • Match legend entry style to reflect components own style.

    Parameters

    • entry: LegendBoxEntry<UIBackground>
    • matchStyleExactly: boolean = false

      By default, entries are assigned a smooth looking gradient based on the component color. If this flag is true, then this is skipped, and exact component solid fill is used instead.

    Returns void