igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
496 lines (491 loc) • 14.9 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrAxis } from "./igr-axis";
import { OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { IgrOverlayTextUpdatingEventArgs } from "./igr-overlay-text-updating-event-args";
import { IgrSeries } from "./igr-series";
import { ValueOverlay } from "./ValueOverlay";
import { ensureBool, brushToString, stringToBrush, ensureEnum, toPoint, fromPoint } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
/**
* Represents the class of the value overlay. The value overlay is a line or circle representing a value on an axis.
*/
export class IgrValueOverlay extends IgrSeries {
createImplementation() {
return new ValueOverlay();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor(props) {
super(props);
this._axisName = null;
this._stylingOverlayText = null;
this._stylingOverlayText_wrapped = null;
}
/**
* Gets or sets the axis used by the value overlay.
*/
get axis() {
const r = this.i.w6;
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 axis(v) {
if (v != null && this._stylingContainer && v._styling)
v._styling(this._stylingContainer, this, this);
v == null ? this.i.w6 = null : this.i.w6 = v.i;
}
/**
* Gets or sets the name to use to resolve axis from markup.
*/
get axisName() {
return this._axisName;
}
set axisName(v) {
this._axisName = v;
}
/**
* Gets or sets the value of the overlay.
*/
get value() {
return this.i.x7;
}
set value(v) {
this.i.x7 = +v;
}
/**
* Gets or sets whether to draw annotations over the axes where the crosshair meets with them.
*/
get isAxisAnnotationEnabled() {
return this.i.xe;
}
set isAxisAnnotationEnabled(v) {
this.i.xe = ensureBool(v);
}
/**
* Sets or gets a function which takes an object that produces a formatted label for the axis annotation.
*/
get axisAnnotationFormatLabel() {
return this.i.w8;
}
set axisAnnotationFormatLabel(v) {
this.i.w8 = v;
}
/**
* Gets or sets the color to use for the axis annotation text. Leave unset for an automatic value.
*/
get axisAnnotationTextColor() {
return brushToString(this.i.aai);
}
set axisAnnotationTextColor(v) {
this.i.aai = stringToBrush(v);
}
/**
* Gets or sets the color to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackground() {
return brushToString(this.i.aag);
}
set axisAnnotationBackground(v) {
this.i.aag = stringToBrush(v);
}
/**
* Gets or sets the corner radius to use for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationBackgroundCornerRadius() {
return this.i.xm;
}
set axisAnnotationBackgroundCornerRadius(v) {
this.i.xm = +v;
}
/**
* Gets or sets the precision to use displaying values for interpolated positions.
*/
get axisAnnotationInterpolatedValuePrecision() {
return this.i.x8;
}
set axisAnnotationInterpolatedValuePrecision(v) {
this.i.x8 = +v;
}
/**
* Gets or sets the color to use for the axis annotation outline. Leave unset for an automatic value.
*/
get axisAnnotationOutline() {
return brushToString(this.i.aah);
}
set axisAnnotationOutline(v) {
this.i.aah = 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 axisAnnotationPaddingLeft() {
return this.i.xo;
}
set axisAnnotationPaddingLeft(v) {
this.i.xo = +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 axisAnnotationPaddingTop() {
return this.i.xq;
}
set axisAnnotationPaddingTop(v) {
this.i.xq = +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 axisAnnotationPaddingRight() {
return this.i.xp;
}
set axisAnnotationPaddingRight(v) {
this.i.xp = +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 axisAnnotationPaddingBottom() {
return this.i.xn;
}
set axisAnnotationPaddingBottom(v) {
this.i.xn = +v;
}
/**
* Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
*/
get axisAnnotationStrokeThickness() {
return this.i.xr;
}
set axisAnnotationStrokeThickness(v) {
this.i.xr = +v;
}
/**
* Gets whether the series is a value overlay.
*/
get isValueOverlay() {
return this.i.isValueOverlay;
}
get labelResolved() {
return this.i.yn;
}
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get overlayTextLocation() {
return this.i.w9;
}
set overlayTextLocation(v) {
this.i.w9 = ensureEnum(OverlayTextLocation_$type, v);
}
/**
* Gets or sets the horizontal margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalMargin() {
return this.i.x0;
}
set overlayTextHorizontalMargin(v) {
this.i.x0 = +v;
}
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalMargin() {
return this.i.x2;
}
set overlayTextVerticalMargin(v) {
this.i.x2 = +v;
}
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalPadding() {
return this.i.x1;
}
set overlayTextHorizontalPadding(v) {
this.i.x1 = +v;
}
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalPadding() {
return this.i.x3;
}
set overlayTextVerticalPadding(v) {
this.i.x3 = +v;
}
/**
* Gets or sets the angle rotation (in degrees) of the overlay text in relation to shape of data annotation.
*/
get overlayTextAngle() {
return this.i.xu;
}
set overlayTextAngle(v) {
this.i.xu = +v;
}
/**
* Gets or sets the color the overlay text.
*/
get overlayTextColor() {
return brushToString(this.i.aal);
}
set overlayTextColor(v) {
this.i.aal = stringToBrush(v);
}
/**
* Gets or sets the background the overlay text.
*/
get overlayTextBackground() {
return brushToString(this.i.aaj);
}
set overlayTextBackground(v) {
this.i.aaj = stringToBrush(v);
}
/**
* Gets or sets the border stroke of the overlay text.
*/
get overlayTextBorderColor() {
return brushToString(this.i.aak);
}
set overlayTextBorderColor(v) {
this.i.aak = stringToBrush(v);
}
/**
* Gets or sets the border corner of the overlay text.
*/
get overlayTextBorderRadius() {
return this.i.xw;
}
set overlayTextBorderRadius(v) {
this.i.xw = +v;
}
/**
* Gets or sets the border thickness of the overlay text.
*/
get overlayTextBorderThickness() {
return this.i.xy;
}
set overlayTextBorderThickness(v) {
this.i.xy = +v;
}
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get overlayTextVisible() {
return this.i.xi;
}
set overlayTextVisible(v) {
this.i.xi = ensureBool(v);
}
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get overlayText() {
return this.i.yo;
}
set overlayText(v) {
this.i.yo = v;
}
/**
* Gets or sets the shift of the overlay text color based on OverlayTextColorMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextColorShift() {
return this.i.xz;
}
set overlayTextColorShift(v) {
this.i.xz = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextColorMode() {
return this.i.w5;
}
set overlayTextColorMode(v) {
this.i.w5 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get overlayTextColorMatchLayer() {
return this.i.xh;
}
set overlayTextColorMatchLayer(v) {
this.i.xh = ensureBool(v);
}
/**
* Gets or sets the shift of the overlay background based on OverlayTextBackgroundMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextBackgroundShift() {
return this.i.xv;
}
set overlayTextBackgroundShift(v) {
this.i.xv = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextBackgroundMode() {
return this.i.w3;
}
set overlayTextBackgroundMode(v) {
this.i.w3 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get overlayTextBackgroundMatchLayer() {
return this.i.xf;
}
set overlayTextBackgroundMatchLayer(v) {
this.i.xf = ensureBool(v);
}
/**
* Gets or sets the shift of the overlay border based on OverlayTextBorderMode. Value must range between -1.0 to 1.0, where 0 means no color shift.
*/
get overlayTextBorderShift() {
return this.i.xx;
}
set overlayTextBorderShift(v) {
this.i.xx = +v;
}
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get overlayTextBorderMode() {
return this.i.w4;
}
set overlayTextBorderMode(v) {
this.i.w4 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get overlayTextBorderMatchLayer() {
return this.i.xg;
}
set overlayTextBorderMatchLayer(v) {
this.i.xg = ensureBool(v);
}
/**
* Gets or Sets the style to use for the display text.
*/
get overlayTextStyle() {
if (this.i.xd == null) {
return null;
}
return this.i.xd.fontString;
}
set overlayTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.xd = fi;
}
bindAxes(axes) {
super.bindAxes(axes);
for (let i = 0; i < axes.length; i++) {
if (this.axisName && this.axisName.length > 0 &&
axes[i].name == this.axisName) {
this.axis = axes[i];
}
}
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
if (this.axis && this.axis.name && this.axis.name == name) {
return this.axis;
}
return null;
}
_styling(container, component, parent) {
super._styling(container, component, parent);
this._inStyling = true;
if (this.axis && this.axis._styling) {
this.axis._styling(container, component, this);
}
this._inStyling = false;
}
getSeriesValue(world, useInterpolation, skipUnknowns) {
let iv = this.i.i6(toPoint(world), useInterpolation, skipUnknowns);
return (iv);
}
getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
let iv = this.i.wh(toPoint(world), useInterpolation, skipUnknowns);
return fromPoint(iv);
}
/**
* Gets the item index associated with the specified world position
* @param world
*/
getItemIndex(world) {
let iv = this.i.j4(toPoint(world));
return (iv);
}
/**
* Gets the item that is the best match for the specified world coordinates.
* @param world * The world coordinates to use.
*/
getItem(world) {
let iv = this.i.ko(toPoint(world));
return (iv);
}
/**
* Requests that the provided item should be brought into view if possible.
* @param item * The item to attempt to bring into view.
*/
scrollIntoView(item) {
let iv = this.i.ge(item);
return (iv);
}
/**
* Gets the label for a data item.
* @param value * The unscaled value to get a label for.
*/
getLabel(value) {
let iv = this.i.yl(value);
return (iv);
}
/**
* Event raised when updating style of overlay text
*/
get stylingOverlayText() {
return this._stylingOverlayText;
}
set stylingOverlayText(ev) {
if (this._stylingOverlayText_wrapped !== null) {
this.i.stylingOverlayText = delegateRemove(this.i.stylingOverlayText, this._stylingOverlayText_wrapped);
this._stylingOverlayText_wrapped = null;
this._stylingOverlayText = null;
}
this._stylingOverlayText = ev;
this._stylingOverlayText_wrapped = (o, e) => {
let outerArgs = new IgrOverlayTextUpdatingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStylingOverlayText) {
this.beforeStylingOverlayText(this, outerArgs);
}
if (this._stylingOverlayText) {
this._stylingOverlayText(this, outerArgs);
}
};
this.i.stylingOverlayText = delegateCombine(this.i.stylingOverlayText, this._stylingOverlayText_wrapped);
;
}
}