Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

Properties

asyncLabels

asyncLabels: boolean

Experimental - set true to enable async label texture creation Can be set globally using SciChartDefaults. Currently default false.

Protected formatCursorLabelProperty

formatCursorLabelProperty: TFormatLabelFn

Protected formatLabelProperty

formatLabelProperty: TFormatLabelFn

parentAxis

parentAxis: AxisCore

The parent AxisCore. This will be set once attachedToAxis is called

Protected providerId

providerId: string = generateGuid()

Protected styleId

styleId: string

This is the id for the text style used by this axis, as stored in the label cache. Cached labels are accessed by text and styleId. If you have useSharedCache = true and are overriding getLabelTexture or getLabelTextureAsync and do not ensure the style is unique, you might not get the labels you expect. You can either set useSharedCache = false, set this to some unique value, or override getCachedStyle

Protected tickToText

tickToText: Map<number, string> = new Map<number, string>()

Readonly type

type: Text = ELabelProviderType.Text

useCache

useCache: boolean = !IS_TEST_ENV

useSharedCache

useSharedCache: boolean

Whether to use cached labels from other axes that have the same style. You may need to set this false if you are overriding getLabelTexture without setting a unique style. Can be set globally using SciChartDefaults. Currently default false.

Accessors

cursorNumericFormat

cursorPrecision

  • get cursorPrecision(): number
  • set cursorPrecision(value: number): void
  • Gets or sets the precision to use for cursors labels

    Returns number

  • Gets or sets the precision to use for cursors labels

    Parameters

    • value: number

    Returns void

formatCursorLabel

  • Gets or sets a formatCursorLabel function which is used for formatting a data-value into a string for display on a cursor or tooltip If you are creating a custom LabelProvider, you should override formatCursorLabelProperty, not the formatCursorLabel property! See our Documentation

    Returns TFormatLabelFn

  • Gets or sets a formatCursorLabel function which is used for formatting a data-value into a string for display on a cursor or tooltip If you are creating a custom LabelProvider, you should override formatCursorLabelProperty, not the formatCursorLabel property! See our Documentation

    Parameters

    Returns void

formatLabel

  • Gets or sets a formatLabel function which is used for formatting a data-value into a string for display on the axis labels. If you are creating a custom LabelProvider, you should override formatLabelProperty, not the formatLabel property! See our Documentation

    Returns TFormatLabelFn

  • Gets or sets a formatLabel function which is used for formatting a data-value into a string for display on the axis labels. If you are creating a custom LabelProvider, you should override formatLabelProperty, not the formatLabel property! See our Documentation

    Parameters

    Returns void

labels

  • get labels(): Record<number, string | string[]>
  • set labels(labels: Record<number, string | string[]>): void
  • The label text to use. If not set by options this will be an empty array. When adding/updating labels, you should replace the whole array or object if you want to trigger chart updates. If you pass an object like {1:"one", 2:"two", 3:"three"} then labels will be chosen based on the tick value. eg ticks 3,1 will result in "three", "one". If you pass an array like ["one", "two", "three"] then for a category axis it will use the labels in the order given, regardless of data value. If you know that your x data will be a fixed set in a fixed order, then passing an array of labels is simpler. To manually specify multiple lines, pass an array for the label eg ["One line",["Two","Lines"],["Three","more","lines"]]

    Returns Record<number, string | string[]>

  • The label text to use. If not set by options this will be an empty array. When adding/updating labels, you should replace the whole array or object if you want to trigger chart updates. If you pass an object like {1:"one", 2:"two", 3:"three"} then labels will be chosen based on the tick value. eg ticks 3,1 will result in "three", "one". If you pass an array like ["one", "two", "three"] then for a category axis it will use the labels in the order given, regardless of data value. If you know that your x data will be a fixed set in a fixed order, then passing an array of labels is simpler. To manually specify multiple lines, pass an array for the label eg ["One line",["Two","Lines"],["Three","more","lines"]]

    Parameters

    • labels: Record<number, string | string[]>

    Returns void

lineSpacing

  • get lineSpacing(): number
  • set lineSpacing(value: number): void
  • Line spacing to use if text is wrapped, as a multiple of the text height. Defaults to 1.1

    Returns number

  • Line spacing to use if text is wrapped, as a multiple of the text height. Defaults to 1.1

    Parameters

    • value: number

    Returns void

maxLength

  • get maxLength(): number
  • set maxLength(value: number): void
  • Wrap text longer than this number of characters. Will only wrap whole words.

    Returns number

  • Wrap text longer than this number of characters. Will only wrap whole words.

    Parameters

    • value: number

    Returns void

numericFormat

postfix

  • get postfix(): string
  • set postfix(v: string): void
  • Gets or sets a string to add to the end of each label

    Returns string

  • Gets or sets a string to add to the end of each label

    Parameters

    • v: string

    Returns void

precision

  • get precision(): number
  • set precision(value: number): void
  • Gets or sets the precision to use when formatting

    Returns number

  • Gets or sets the precision to use when formatting

    Parameters

    • value: number

    Returns void

prefix

  • get prefix(): string
  • set prefix(v: string): void
  • Gets or sets a string to add to the beginning of each label

    Returns string

  • Gets or sets a string to add to the beginning of each label

    Parameters

    • v: string

    Returns void

rotation

  • get rotation(): number
  • set rotation(value: number): void
  • Returns number

  • Parameters

    • value: number

    Returns void

Methods

applyFormat

  • applyFormat(value: string): string
  • Parameters

    • value: string

    Returns string

attachedToAxis

Protected clearCache

  • clearCache(): void

delete

  • delete(): void

getCachedLabelTexture

  • Get a texture for the given label text. By default the textures are created first and then the resulting sizes are used by the layout functions

    Parameters

    • labelText: string

      The required text

    • textureManager: TextureManager

      A textureManager instance which contains methods for creating textures

    • labelStyle: TTextStyle

      The style for the text

    Returns TTextureObject

    A TTextureObject containing the bitmapTexture and the size

Protected getCachedStyle

getLabelHeight

  • getLabelHeight(ctx: CanvasRenderingContext2D, labelText: string, labelStyle: TTextStyle): number
  • Called during axis layout to get the height of the label

    Parameters

    • ctx: CanvasRenderingContext2D

      the CanvasRenderingContext2D which can be used to perform text measurment

    • labelText: string

      the text of the label

    • labelStyle: TTextStyle

      the style of the label

    Returns number

    the label height in pixels

getLabelTexture

  • getLabelTexture(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): { bitmapTexture: TSRTexture; textureHeight: number; textureWidth: number }
  • Parameters

    Returns { bitmapTexture: TSRTexture; textureHeight: number; textureWidth: number }

    • bitmapTexture: TSRTexture
    • textureHeight: number
    • textureWidth: number

getLabelTextureAsync

  • getLabelTextureAsync(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): Promise<{ bitmapTexture: TSRTexture; textureHeight: number; textureWidth: number }>

getLabelWidth

  • getLabelWidth(ctx: CanvasRenderingContext2D, labelText: string, labelStyle?: TTextStyle): number
  • Parameters

    • ctx: CanvasRenderingContext2D
    • labelText: string
    • Optional labelStyle: TTextStyle

    Returns number

getLabels

  • getLabels(majorTicks: number[]): string[]
  • Returns an array of label strings for an array of major tick numeric values

    Parameters

    • majorTicks: number[]

      The major tick numeric values

    Returns string[]

getMaxLabelHeightForHorizontalAxis

  • getMaxLabelHeightForHorizontalAxis(majorTickLabels: string[], ctx: CanvasRenderingContext2D, labelStyle: TTextStyle): number
  • Called during axis layout to get the maximum height of labels on a horizontal axis. Normally this calls getLabelHeight for each label and returns the largest.

    Parameters

    • majorTickLabels: string[]

      an array of text labels

    • ctx: CanvasRenderingContext2D

      the CanvasRenderingContext2D which can be used to perform text measurment

    • labelStyle: TTextStyle

      the style of the labels

    Returns number

    the maximum label height in pixels

getMaxLabelWidthForVerticalAxis

  • getMaxLabelWidthForVerticalAxis(majorTickLabels: string[], ctx: CanvasRenderingContext2D, labelStyle: TTextStyle): number
  • Called during axis layout to get the maximum width of labels on a vertical axis. Normally this calls getLabelWidth for each label and returns the largest.

    Parameters

    • majorTickLabels: string[]

      an array of text labels

    • ctx: CanvasRenderingContext2D

      the CanvasRenderingContext2D which can be used to perform text measurment

    • labelStyle: TTextStyle

      the style of the labels

    Returns number

    the maximum label width in pixels

Protected invalidateParent

  • invalidateParent(): void

onBeginAxisDraw

  • onBeginAxisDraw(): void

toJSON

  • toJSON(): { options: {}; type: string }
  • Returns { options: {}; type: string }

    • options: {}
    • type: string

wrapText

  • wrapText(text: string): string[]
  • Convert the label text to an array of lines

    Parameters

    • text: string

    Returns string[]

Generated using TypeDoc