Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides an implementation of Numeric Coordinate Calculator which transforms numeric data indexes for CategoryAxis to pixel coordinates and vice versa.

remarks

SciChart's JavaScript Charts perform conversion operations between data-coordinates for all drawing and axis measurements.

You can fetch a {link CategoryCoordinateCalculator} instance by calling AxisCore.getCurrentCoordinateCalculator on a CategoryAxis. This will return a unique calculator for the current draw pass.

You can convert pixel to data-indexes and back by using the following code. An additional method for Category calculators transforms between data-value and index:

const axis: AxisCore;
const calc = axis.getCurrentCoordinateCalculator();

const pixel = calc.getCoordinate(11); // Gets the pixel coordinate for data at index 11
const dataIndex = calc.getDataValue(pixel); // Performs the inverse operation to get data-value
const dataValue = calc.transformIndexToData(dataIndex); // Converts index to data-value

Use the Coordinate calculators when drawing, placing markers, annotations or if you want to place a tooltip over the chart.

Hierarchy

Implements

Index

Constructors

constructor

  • Creates an instance of CategoryCoordinateCalculator

    Parameters

    • webAssemblyContext: TSciChart

      The SciChart 2D WebAssembly Context or {@link TSciChart2D | SciChart 2D WebAssembly Context} containing native methods and access to our WebGL2 Engine and WebAssembly numerical methods

    • viewportDimension: number

      The size of the associated Axis at the time of drawing

    • visibleMin: number

      The CategoryAxis.visibleRange.min at the time of drawing, corresponding to the minimum data-index visible

    • visibleMax: number

      The CategoryAxis.visibleRange.max at the time of drawing, corresponding to the maximum data-index visible

    • Default value offset: number = 0

      A constant pixel offset used in coordinate calculations

    Returns CategoryCoordinateCalculator

Properties

baseXValues

baseXValues: SCRTDoubleVector

The primary chart series X-values, required for category calculations and interpolation / extrapolation

Readonly hasFlippedCoordinates

hasFlippedCoordinates: boolean

When true, this coordinate calculator has flipped coordinates

Readonly indexMax

indexMax: number

The indexMax is the CategoryAxis.visibleRange.max at the time of drawing, corresponding to the maximum data-index visible

Readonly indexMin

indexMin: number

The indexMin is the CategoryAxis.visibleRange.min at the time of drawing, corresponding to the minimum data-index visible

Readonly isCategoryCoordinateCalculator

isCategoryCoordinateCalculator: boolean

When true, this coordinate calculator behaves as a Category coordinate calculator, using index not x-value for measuring

nativeCalculator

nativeCalculator: CoordinateCalculator

Gets the native (WebAssembly) {@link CoordinateCalculator} instance

offset

offset: number

Gets or sets a constant offset in pixels for all generated coordinates

Readonly viewportDimension

viewportDimension: number

Gets or sets the ViewportDimension, corresponding to the size of the associated Axis at the time of drawing

Readonly visibleMax

visibleMax: number

Gets or sets the Visible maximum value, corresponding to AxisCore.visibleRange.max at the time of drawing

Readonly visibleMin

visibleMin: number

Gets or sets the Visible minimum value, corresponding to AxisCore.visibleRange.min at the time of drawing

Protected webAssemblyContext

webAssemblyContext: TSciChart | TSciChart3D

The SciChart 2D WebAssembly Context or {@link TSciChart2D | SciChart 2D WebAssembly Context} containing native methods and access to our WebGL2 Engine and WebAssembly numerical methods

Methods

delete

  • delete(): void
  • Deletes native (WebAssembly) memory used by this type, after which it cannot be used.

    remarks

    Call .delete() before finishing with the object to ensure that WebAssmembly memory leaks do not occur.

    All elements within SciChart's High Performance Realtime JavaScript Charts which implement IDeletable must be deleted manually to free native (WebAssembly) memory

    Returns void

getCoordinate

  • getCoordinate(dataValue: number): number
  • Converts the Data-value to a pixel coordinate Performs the inverse operation to getDataValue

    Parameters

    • dataValue: number

      The data-value

    Returns number

    the pixel coordinate

getDataValue

  • getDataValue(coordinate: number): number
  • Converts the pixel coordinate to a Data-value. Performs the inverse operation to getCoordinate

    Parameters

    • coordinate: number

      The pixel coordiante

    Returns number

    the data value

transformDataToIndex

  • transformDataToIndex(dataValue: number): number
  • Transforms an Data-value to Index, with extrapolation and interpolation for values found outside of the Primary Chart series X-Values

    Parameters

    • dataValue: number

    Returns number

    the index

transformIndexToData

  • transformIndexToData(index: number): number
  • Transforms an Index to a Data-value, with extrapolation and interpolation for values found outside of the Primary Chart series X-Values

    Parameters

    • index: number

      the index to transform

    Returns number

    the Data-value

translateBy

  • Translates a NumberRange in Data-coordinates by a specified number of pixels, performing intermediate calculations from data-value to pixel and back to perform the translation

    Parameters

    Returns NumberRange

    The translated range

zoomTranslateBy

Generated using TypeDoc