UNPKG

igniteui-react-charts

Version:

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

136 lines (134 loc) 3.97 kB
import { IgrAxis } from "./igr-axis"; import { IgrAnnotationLayer } from "./igr-annotation-layer"; import { CategoryToolTipLayer } from "./CategoryToolTipLayer"; import { ensureBool, brushToString, stringToBrush } from "igniteui-react-core"; /** * Represents an annotation layer that displays grouped tooltips for series that use a category axis. */ export class IgrCategoryToolTipLayer extends IgrAnnotationLayer { createImplementation() { return new CategoryToolTipLayer(); } /** * @hidden */ get i() { return this._implementation; } constructor(props) { super(props); this._targetAxisName = null; } /** * Gets whether the series is an annotation layer displayed only when hovering over the chart. */ get isAnnotationHoverLayer() { return this.i.et; } /** * Gets whether the default tooltip behaviors for the chart are disabled if this layer is present. */ get isDefaultTooltipBehaviorDisabled() { return this.i.e4; } /** * Gets or sets the Axis to target this annotation to. If null, this annotation layer will not render content. */ get targetAxis() { const r = this.i.aag; if (r == null) { return null; } if (!r.externalObject) { let e = IgrAxis._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; } set targetAxis(v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.aag = null : this.i.aag = v.i; } /** * Gets or sets the name to use to resolve targetAxis from markup. */ get targetAxisName() { return this._targetAxisName; } set targetAxisName(v) { this._targetAxisName = v; } /** * Gets or sets whether to use value interpolation when drawing the tooltips. */ get useInterpolation() { return this.i.aak; } set useInterpolation(v) { this.i.aak = ensureBool(v); } /** * Gets or sets the background of the tooltip containers. */ get toolTipBackground() { return brushToString(this.i.aa0); } set toolTipBackground(v) { this.i.aa0 = stringToBrush(v); } /** * Gets or sets the border color of the tooltip containers. */ get toolTipBorderBrush() { return brushToString(this.i.aa1); } set toolTipBorderBrush(v) { this.i.aa1 = stringToBrush(v); } /** * Gets or sets the border thickness of the tooltip containers. */ get toolTipBorderThickness() { return this.i.aal; } set toolTipBorderThickness(v) { this.i.aal = +v; } bindAxes(axes) { super.bindAxes(axes); for (let i = 0; i < axes.length; i++) { if (this.targetAxisName && this.targetAxisName.length > 0 && axes[i].name == this.targetAxisName) { this.targetAxis = axes[i]; } } } findByName(name) { var baseResult = super.findByName(name); if (baseResult) { return baseResult; } if (this.targetAxis && this.targetAxis.name && this.targetAxis.name == name) { return this.targetAxis; } return null; } _styling(container, component, parent) { super._styling(container, component, parent); this._inStyling = true; if (this.targetAxis && this.targetAxis._styling) { this.targetAxis._styling(container, component, this); } this._inStyling = false; } /** * Hides any tooltips presented by the layer, if any. */ hideToolTips() { this.i.qd(); } }