UNPKG

igniteui-react-charts

Version:

Ignite UI React charting components for building rich data visualizations using TypeScript APIs.

345 lines (344 loc) 11 kB
import { IgrSeries } from "./igr-series"; import { Visibility_$type } from "igniteui-react-core"; import { IgrAnnotationLayer } from "./igr-annotation-layer"; import { CrosshairLayer } from "./CrosshairLayer"; import { ensureBool, brushToString, stringToBrush, ensureEnum } from "igniteui-react-core"; /** * Represents an annotation layer that displays crosshair lines that cross through the closest value of the target series under the cursor. */ export class IgrCrosshairLayer extends IgrAnnotationLayer { createImplementation() { return new CrosshairLayer(); } /** * @hidden */ get i() { return this._implementation; } constructor(props) { super(props); } /** * Gets whether the series is an annotation layer displayed only when hovering over the chart. */ get isAnnotationHoverLayer() { return this.i.eu; } /** * Gets whether the series is an crosshair annotation layer. */ get isAnnotationCrosshairLayer() { return this.i.er; } /** * Gets or sets the color to use for the horizontal line. Leave null for an automatic value. */ get horizontalLineStroke() { return brushToString(this.i.add); } set horizontalLineStroke(v) { this.i.add = stringToBrush(v); } /** * Gets or sets the color to use for vertical line. Leave null for an automatic value. */ get verticalLineStroke() { return brushToString(this.i.ade); } set verticalLineStroke(v) { this.i.ade = stringToBrush(v); } /** * Gets or sets the name of the series to target this annotation to. If null, this annotation targets all series simultaneously. */ get targetSeriesName() { return this.i.abp; } set targetSeriesName(v) { this.i.abp = v; } /** * Gets or sets the series to target this annotation to. If null, this annotation targets all series simultaneously. */ get targetSeries() { const r = this.i.aav; if (r == null) { return null; } if (!r.externalObject) { let e = IgrSeries._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; } set targetSeries(v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.aav = null : this.i.aav = v.i; } /** * Gets or sets whether to use value interpolation when drawing a line through the best value for the cursor position. */ get useInterpolation() { return this.i.aa2; } set useInterpolation(v) { this.i.aa2 = ensureBool(v); } /** * Gets or sets whether to draw annotations over the axes where the crosshair meets with them. */ get isAxisAnnotationEnabled() { return this.i.aay; } set isAxisAnnotationEnabled(v) { this.i.aay = ensureBool(v); } /** * Gets or sets the color to use for the x axis annotation text. Leave unset for an automatic value. */ get xAxisAnnotationTextColor() { return brushToString(this.i.adh); } set xAxisAnnotationTextColor(v) { this.i.adh = stringToBrush(v); } /** * Gets or sets the color to use for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationBackground() { return brushToString(this.i.adf); } set xAxisAnnotationBackground(v) { this.i.adf = stringToBrush(v); } /** * Gets or sets the corner radius to use for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationBackgroundCornerRadius() { return this.i.aa5; } set xAxisAnnotationBackgroundCornerRadius(v) { this.i.aa5 = +v; } /** * Gets or sets the precision to use displaying values for interpolated crosshair positions. */ get xAxisAnnotationInterpolatedValuePrecision() { return this.i.abh; } set xAxisAnnotationInterpolatedValuePrecision(v) { this.i.abh = +v; } /** * Gets or sets the color to use for the x axis annotation outline. Leave unset for an automatic value. */ get xAxisAnnotationOutline() { return brushToString(this.i.adg); } set xAxisAnnotationOutline(v) { this.i.adg = stringToBrush(v); } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get xAxisAnnotationPaddingLeft() { return this.i.aa7; } set xAxisAnnotationPaddingLeft(v) { this.i.aa7 = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get xAxisAnnotationPaddingTop() { return this.i.aa9; } set xAxisAnnotationPaddingTop(v) { this.i.aa9 = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get xAxisAnnotationPaddingRight() { return this.i.aa8; } set xAxisAnnotationPaddingRight(v) { this.i.aa8 = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get xAxisAnnotationPaddingBottom() { return this.i.aa6; } set xAxisAnnotationPaddingBottom(v) { this.i.aa6 = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get yAxisAnnotationPaddingLeft() { return this.i.abd; } set yAxisAnnotationPaddingLeft(v) { this.i.abd = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get yAxisAnnotationPaddingTop() { return this.i.abf; } set yAxisAnnotationPaddingTop(v) { this.i.abf = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get yAxisAnnotationPaddingRight() { return this.i.abe; } set yAxisAnnotationPaddingRight(v) { this.i.abe = +v; } /** * Gets or sets the padding to use withing the axis annotation callout. Leaving this NaN will use an automatic value related to the axis label margins. */ get yAxisAnnotationPaddingBottom() { return this.i.abc; } set yAxisAnnotationPaddingBottom(v) { this.i.abc = +v; } /** * Gets or sets the stroke thickness for the x axis annotation backing. Leave unset for an automatic value. */ get xAxisAnnotationStrokeThickness() { return this.i.aba; } set xAxisAnnotationStrokeThickness(v) { this.i.aba = +v; } /** * Gets or sets the color to use for the y axis annotation text. Leave unset for an automatic value. */ get yAxisAnnotationTextColor() { return brushToString(this.i.adk); } set yAxisAnnotationTextColor(v) { this.i.adk = stringToBrush(v); } /** * Gets or sets the color to use for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationBackground() { return brushToString(this.i.adi); } set yAxisAnnotationBackground(v) { this.i.adi = stringToBrush(v); } /** * Gets or sets the corner radius to use for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationBackgroundCornerRadius() { return this.i.abb; } set yAxisAnnotationBackgroundCornerRadius(v) { this.i.abb = +v; } /** * Gets or sets the precision to use displaying values for interpolated crosshair positions. */ get yAxisAnnotationInterpolatedValuePrecision() { return this.i.abi; } set yAxisAnnotationInterpolatedValuePrecision(v) { this.i.abi = +v; } /** * Gets or sets the color to use for the y axis annotation outline. Leave unset for an automatic value. */ get yAxisAnnotationOutline() { return brushToString(this.i.adj); } set yAxisAnnotationOutline(v) { this.i.adj = stringToBrush(v); } /** * Gets or sets the stroke thickness for the y axis annotation backing. Leave unset for an automatic value. */ get yAxisAnnotationStrokeThickness() { return this.i.abg; } set yAxisAnnotationStrokeThickness(v) { this.i.abg = +v; } /** * Gets or sets whether to display the vertical line. */ get verticalLineVisibility() { return this.i.adq; } set verticalLineVisibility(v) { this.i.adq = ensureEnum(Visibility_$type, v); } /** * Gets or sets whether to display the horizontal line. */ get horizontalLineVisibility() { return this.i.adp; } set horizontalLineVisibility(v) { this.i.adp = ensureEnum(Visibility_$type, v); } /** * Gets or sets whether to skip unknown values when searching for series values. */ get skipUnknownValues() { return this.i.aa1; } set skipUnknownValues(v) { this.i.aa1 = ensureBool(v); } /** * Gets or sets whether axis annotation are skipped for zero-value fragments in a given position. */ get skipAxisAnnotationOnZeroValueFragments() { return this.i.aa0; } set skipAxisAnnotationOnZeroValueFragments(v) { this.i.aa0 = ensureBool(v); } /** * Gets or sets whether axis annotation are skipped for invalid data in a given position. */ get skipAxisAnnotationOnInvalidData() { return this.i.aaz; } set skipAxisAnnotationOnInvalidData(v) { this.i.aaz = ensureBool(v); } findByName(name) { var baseResult = super.findByName(name); if (baseResult) { return baseResult; } if (this.targetSeries && this.targetSeries.name && this.targetSeries.name == name) { return this.targetSeries; } return null; } _styling(container, component, parent) { super._styling(container, component, parent); this._inStyling = true; if (this.targetSeries && this.targetSeries._styling) { this.targetSeries._styling(container, component, this); } this._inStyling = false; } }