Options
All
  • Public
  • Public/Protected
  • All
Menu

A DataLabelProvider sepcifically designed to work with or any series that uses an {@link XYTextDataSeries } Text is taken directly from the textValues on the dataSeries and placed at the x,y coordinates (anchored top, left)

Hierarchy

Index

Constructors

constructor

Properties

calculateTextBounds

calculateTextBounds: boolean = false

This default false for maximum performance. It will be true if you set the textPosition to something other than Above, Right. You can force it true if you want to make use of the text sizes in onAfterGenerate

Protected colorProperty

colorProperty: string

dataLabels

dataLabels: TDataLabel[] = []

The text to draw, along with the sizes and positions. Usually generated, but can be updated before final drawing

drawImmediate

drawImmediate: boolean = false

Draws immediately, set this True when using sub-surfaces for proper data label layering

Protected engineeringPrefixProperty

engineeringPrefixProperty: IEngineeringPrefix

Protected formatValueProperty

formatValueProperty: TFormatLabelFn

getClipRect

getClipRect: ((renderPassData: RenderPassData) => Rect) | undefined

When set, this provider's labels are drawn immediately after generation (during the series draw), clipped to the returned rect (surface coordinates), instead of in the deferred global text pass. See IBaseDataLabelProviderOptions.getClipRect

Protected horizontalTextPositionProperty

horizontalTextPositionProperty: EHorizontalTextPosition = EHorizontalTextPosition.Right

Protected isEnabledProperty

isEnabledProperty: boolean = true

Protected labelFormatProperty

labelFormatProperty: ENumericFormat = undefined

undefined until explicitly set, which is what distinguishes "the caller asked for nothing" from "the caller asked for Decimal". Only that distinction lets an unset provider fall back to the formatted column's EColumnType default while an explicit setting still wins. The PUBLIC labelFormat getter resolves it, so the sentinel never leaves this class.

Protected labelPostfixProperty

labelPostfixProperty: string

Protected labelPrecisionProperty

labelPrecisionProperty: number = undefined

undefined until explicitly set - see labelFormatProperty.

Protected labelPrefixProperty

labelPrefixProperty: string

Protected parentSeries

parentSeries: IRenderableSeries

The Parent RenderableSeries

Protected state

Protected styleProperty

styleProperty: TDataLabelStyle

Protected textBounds

textBounds: TSRTextBounds

Reusable native text-bounds buffer, allocated once at attach time. Hoisted here so allocation never happens on the render path — first-time native allocation can grow the WASM heap and detach any Float64Array views captured earlier in the same frame (e.g. inside a DataLabelState).

Protected textFieldProperty

textFieldProperty: string | number

type

type: EDataLabelProviderType = EDataLabelProviderType.Text

useNativeStringDraw

useNativeStringDraw: boolean = false

Opt-in: draw string cells natively from the dictionary by code (no per-frame JS string). Default off; only engages when textField names a string column on the data series and there is no prefix/postfix (identity format).

Protected Readonly valueToText

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

Protected verticalTextPositionProperty

verticalTextPositionProperty: EVerticalTextPosition = EVerticalTextPosition.Above

Protected webAssemblyContext

webAssemblyContext: TSciChart

The SciChart 2D WebAssembly Context containing native methods and access to our WebGL2 Engine and WebAssembly numerical methods

Static Protected Readonly DEFAULT_LABEL_FORMAT

DEFAULT_LABEL_FORMAT: Decimal = ENumericFormat.Decimal

The value labelFormat reports, and the last resort in resolveFormat.

Static Protected Readonly DEFAULT_LABEL_PRECISION

DEFAULT_LABEL_PRECISION: 1 = 1

The value labelPrecision reports, and the last resort in resolveFormat.

Static MAX_CACHE_SIZE

MAX_CACHE_SIZE: number = 10000

Max entries in the value→text cache before it is cleared (simple bound, no LRU)

Accessors

color

  • get color(): string
  • set color(value: string): void
  • Gets or sets the color for data labels. Defaults to axis label color

    Returns string

  • Gets or sets the color for data labels. Defaults to axis label color

    Parameters

    • value: string

    Returns void

engineeringPrefix

formatValue

  • Gets or sets the function converting a data value to text. Defaults to formatNumber with labelFormat/labelPrecision/engineeringPrefix

    Returns TFormatLabelFn

  • Gets or sets the function converting a data value to text. Defaults to formatNumber with labelFormat/labelPrecision/engineeringPrefix

    Parameters

    Returns void

horizontalTextPosition

  • Gets or sets the horizontal text position for the label For more control, override getPosition

    Returns EHorizontalTextPosition

  • Gets or sets the horizontal text position for the label For more control, override getPosition

    Parameters

    Returns void

isEnabled

  • get isEnabled(): boolean
  • set isEnabled(value: boolean): void
  • Flag to enable/disable dataLabel generation. Default true

    Returns boolean

  • Flag to enable/disable dataLabel generation. Default true

    Parameters

    • value: boolean

    Returns void

labelFormat

  • Gets or sets the numeric format used to convert values to text (includes date formats). Default ENumericFormat.Decimal

    Returns ENumericFormat

  • Gets or sets the numeric format used to convert values to text (includes date formats). Default ENumericFormat.Decimal

    Parameters

    Returns void

labelPostfix

  • get labelPostfix(): string
  • set labelPostfix(value: string): void
  • Gets or sets a postfix added to each formatted label

    Returns string

  • Gets or sets a postfix added to each formatted label

    Parameters

    • value: string

    Returns void

labelPrecision

  • get labelPrecision(): number
  • set labelPrecision(value: number): void
  • Gets or sets the number of decimal places (or significant figures, format-dependent) used to convert values to text. Default 1

    Returns number

  • Gets or sets the number of decimal places (or significant figures, format-dependent) used to convert values to text. Default 1

    Parameters

    • value: number

    Returns void

labelPrefix

  • get labelPrefix(): string
  • set labelPrefix(value: string): void
  • Gets or sets a prefix added to each formatted label

    Returns string

  • Gets or sets a prefix added to each formatted label

    Parameters

    • value: string

    Returns void

style

  • Gets or sets the text style used for data labels. The style must be set, with fontFamily and fontSize set, in order for text to be drawn.

    Returns TDataLabelStyle

  • Gets or sets the text style used for data labels. The style must be set, with fontFamily and fontSize set, in order for text to be drawn.

    Parameters

    Returns void

textField

  • get textField(): string | number
  • set textField(value: string | number): void
  • Gets or sets the name or index of a value array on the dataSeries whose values are formatted as the label text. When unset, an XyTextDataSeries' textValues or the series' selected y values are used.

    Returns string | number

  • Gets or sets the name or index of a value array on the dataSeries whose values are formatted as the label text. When unset, an XyTextDataSeries' textValues or the series' selected y values are used.

    Parameters

    • value: string | number

    Returns void

Protected useRotation

  • get useRotation(): boolean

verticalTextPosition

  • Gets or sets the vertical text position for the label For more control, override getPosition

    Returns EVerticalTextPosition

  • Gets or sets the vertical text position for the label For more control, override getPosition

    Parameters

    Returns void

Methods

applyFormat

  • applyFormat(value: string): string
  • Adds labelPrefix / labelPostfix around a formatted value

    Parameters

    • value: string

    Returns string

delete

  • delete(): void
  • Returns void

draw

drawClipped

  • Draws this provider's labels immediately, clipped to the given rect (surface coordinates). Pre-flushes any pending font batches under the state they expect (identity transform + surface clip) so the clip cannot apply to text batched by others, then sets the label clip and force-ends the font so the clip applies to exactly this provider's labels, then restores the seriesViewRect transform + clip.

    Parameters

    Returns void

Protected drawLabels

generateDataLabels

getColor

  • Parameters

    Returns number

getDataLabelState

Protected getLineSpacing

  • getLineSpacing(): number

getPosition

  • Parameters

    Returns Point

getTextForValue

  • getTextForValue(value: number): string
  • Converts a numeric value to label text via formatValue, caching the result per value. NaN returns undefined (no label).

    Parameters

    • value: number

    Returns string

Protected invalidateParent

  • invalidateParent(): void

onAfterGenerate

  • Called after labels are generated but before they are drawn.

    Parameters

    Returns void

onAttach

onDetach

  • onDetach(): void
  • Returns void

resolveAutoColors

  • resolveAutoColors(index: number, maxSeries: number, theme: IThemeProvider): void

Protected resolveColumnType

  • Resolves the declared EColumnType of the data-series column whose values this provider is turning into text, or undefined when there is none. Supplies the formatting DEFAULT that an unset numericFormat/precision (or labelFormat/labelPrecision) falls back to — see DEFAULT_FORMAT_FOR_COLUMN_TYPE. An explicit setting always wins over it.

    getColumnType is optional-called as a CAPABILITY, matching how getTextAt is reached on this path: any DataSeries able to declare column types serves one, and anything else (a plain XyDataSeries, a third-party IDataSeries) simply falls through to the class default.

    Parameters

    • parentSeries: IRenderableSeries

      the renderable series the labels are being drawn for

    • Optional field: string | number

      the column the provider was explicitly pointed at (a name, or an index into valueNames), or undefined to use the series' own y selection

    Returns EColumnType | undefined

Protected resolveFormat

  • resolveFormat(): { numericFormat: ENumericFormat; precision: number }
  • Resolves the format and precision to render a value with, in strict precedence:

    1. an explicit labelFormat / labelPrecision — always wins;
    2. otherwise the DEFAULT_FORMAT_FOR_COLUMN_TYPE entry for the declared EColumnType of the column being formatted;
    3. otherwise the class defaults, Decimal and 1.

    The two resolve INDEPENDENTLY, so setting one does not silently pin the other.

    Returns { numericFormat: ENumericFormat; precision: number }

Protected resolveNativeStringSource

  • resolveNativeStringSource(): { codes: Int32Array; dict: SCRTStringDictionary } | undefined
  • When useNativeStringDraw is on and textField names a string column on the data series with no prefix/postfix, returns the native dictionary handle + a zero-copy codes view so the renderer can draw each cell straight from the dictionary by code (no per-frame JS string). The series' concrete type is irrelevant - only whether it carries the column. Returns undefined otherwise, so the caller falls back to the normal string path. Prefix/postfix disqualify it because native draw bypasses applyFormat.

    Returns { codes: Int32Array; dict: SCRTStringDictionary } | undefined

resolveTextSource

  • resolveTextSource(): ((dataIndex: number) => string) | undefined
  • Resolves the function that supplies label text per data index for this render pass: textField → XyTextDataSeries textValues → the series' selected y values, formatted. Returns undefined if no source is available.

    Returns ((dataIndex: number) => string) | undefined

shouldGenerate

  • Called at the start of generateDataLabels. If False, no labels will be generated.

    Parameters

    Returns boolean

toJSON

updateStyle

  • Update the style. Only the properties passed will be updated

    Parameters

    Returns void

Generated using TypeDoc