Options
All
  • Public
  • Public/Protected
  • All
Menu

This is the standard DataLabelProvider which provides a number of options for configuring data labels. It defines a much richer api than BaseDataLabelProvider and is intended to be used as a base for doing small changes to data label behaviour generateDataLabels calls the following functions which you can override parts of the behaviour ySelector to pick the desired yValues from the pointSeries. shouldGenerate to determine if any labels should be generated so you can enable labels depending on zoom or data level. Then for each data point: getText Build in behaviour can get text from metadata using metaDataSelector or format the y values using numericFormat and precision getPosition By default return the x and y coordinate of the data point. Series-specific DataLabelProviders eg LineSeriesDataLabelProvider have logic to adjust text position based on the series getColor Returns the color from the text style. Use parseColorToUIntArgb to turn color string to the required numeric value if overriding. shouldSkipLabel Decides whether to keep or ship the generated label based on the {@link }

Hierarchy

Index

Constructors

constructor

Properties

Protected colorProperty

colorProperty: string

dataLabels

dataLabels: TDataLabel[] = []

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

Protected horizontalTextPositionProperty

horizontalTextPositionProperty: EHorizontalTextPosition = EHorizontalTextPosition.Right

Protected isEnabledProperty

isEnabledProperty: boolean = true

metaDataSelector

metaDataSelector: (metadata: IPointMetadata) => string

If this is set it will be used to get text values from metaData, rather than formatting y values. The selector will be called even if the metaData for an index is undefined.

Type declaration

Protected numericFormatProperty

numericFormatProperty: ENumericFormat = ENumericFormat.Decimal

Protected parentSeries

parentSeries: IRenderableSeries

The Parent RenderableSeries

Protected pointCountThresholdProperty

pointCountThresholdProperty: number = Infinity

Protected pointGapThresholdProperty

pointGapThresholdProperty: number = 0

Protected precisionProperty

precisionProperty: number = 1

Protected skipModeProperty

skipModeProperty: EDataLabelSkipMode = EDataLabelSkipMode.SkipIfOverlapPrevious

Protected skipNumberProperty

skipNumberProperty: number = 0

Protected state

Protected styleProperty

styleProperty: TDataLabelStyle

Readonly type

type: EDataLabelProviderType = EDataLabelProviderType.Default

updateTextInAnimation

updateTextInAnimation: boolean = false

Whether the label text should update when the label position is animating. Default false.

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

ySelector

ySelector: (ps: IPointSeries) => SCRTDoubleVector

A function to pick which y values to use from the pointSeries passed in on the renderPassData

Type declaration

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

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

numericFormat

  • Gets or sets numeric format to use when formatting values to text. For a list of values, see ENumericFormat For more control, override getText

    Returns ENumericFormat

  • Gets or sets numeric format to use when formatting values to text. For a list of values, see ENumericFormat For more control, override getText

    Parameters

    Returns void

pointCountThreshold

  • get pointCountThreshold(): number
  • set pointCountThreshold(value: number): void
  • Gets or sets the number of points below which drawing will start. Default Infinity This can be used instead of pointGapThreshold when data is unevenly spaced or has large y variation

    Returns number

  • Gets or sets the number of points below which drawing will start. Default Infinity This can be used instead of pointGapThreshold when data is unevenly spaced or has large y variation

    Parameters

    • value: number

    Returns void

pointGapThreshold

  • get pointGapThreshold(): number
  • set pointGapThreshold(value: number): void
  • Gets or sets the zoom threshold above which label drawing will start. Default 0. This is expressed as the gap between the first points divided by the size of the first text If data is unevenly spaced, consider pointCountThreshold or override shouldDrawText

    Returns number

  • Gets or sets the zoom threshold above which label drawing will start. Default 0. This is expressed as the gap between the first points divided by the size of the first text If data is unevenly spaced, consider pointCountThreshold or override shouldDrawText

    Parameters

    • value: number

    Returns void

precision

  • get precision(): number
  • set precision(value: number): void
  • Gets or sets the precision to use when formatting values to text For more control, override getText

    Returns number

  • Gets or sets the precision to use when formatting values to text For more control, override getText

    Parameters

    • value: number

    Returns void

skipMode

  • How do decide whether to keep or skip a label once generated. Override shouldSkipLabel for more control

    Returns EDataLabelSkipMode

  • How do decide whether to keep or skip a label once generated. Override shouldSkipLabel for more control

    Parameters

    Returns void

skipNumber

  • get skipNumber(): number
  • set skipNumber(value: number): void
  • The number of points to skip while generating labels. Default 0 = no skip. 1 = skip every other. When creating text with many data points, it will help performance to skip points rather than creating and checking overlap for every data point.

    Returns number

  • The number of points to skip while generating labels. Default 0 = no skip. 1 = skip every other. When creating text with many data points, it will help performance to skip points rather than creating and checking overlap for every data point.

    Parameters

    • value: number

    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

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

delete

  • delete(): void
  • Returns void

draw

generateDataLabels

getColor

  • Parameters

    Returns number

getPosition

  • Parameters

    Returns Point

getText

  • Parameters

    Returns string

Protected invalidateParent

  • invalidateParent(): void

onAttach

onDetach

  • onDetach(): void
  • Returns void

resolveAutoColors

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

shouldGenerate

  • Called at the start of generateDataLabels. If false, no labels will be generated. Checks pointCountThreshold then pointGapThreshold

    Parameters

    Returns boolean

shouldSkipLabel

  • Parameters

    Returns boolean

toJSON

updateStyle

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

    Parameters

    Returns void

Generated using TypeDoc