igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
404 lines (397 loc) • 13 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { OverlayTextLocation_$type } from "./OverlayTextLocation";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { IgrOverlayTextUpdatingEventArgs } from "./igr-overlay-text-updating-event-args";
import { IgrDataAnnotationItem } from "./igr-data-annotation-item";
import { IgrDataAnnotationInfo } from "./igr-data-annotation-info";
import { IgrDataAnnotationAxisLayer } from "./igr-data-annotation-axis-layer";
import { ensureBool, ensureEnum, brushToString, stringToBrush, toPoint, fromPoint } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
/**
* Represents a base annotation layer that renders shapes defined by derived data annotation, e.g. line, strip, slice, rect, band
*/
export class IgrDataAnnotationShapeLayer extends IgrDataAnnotationAxisLayer {
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor(props) {
super(props);
this._stylingOverlayText = null;
this._stylingOverlayText_wrapped = null;
this._stylingShapeAnnotation = null;
this._stylingShapeAnnotation_wrapped = null;
this._stylingAxisAnnotation = null;
this._stylingAxisAnnotation_wrapped = null;
}
/**
* Gets or sets whether to draw shape of annotations in the plot area
*/
get annotationShapeVisible() {
return this.i.acl;
}
set annotationShapeVisible(v) {
this.i.acl = ensureBool(v);
}
/**
* Gets or sets whether the data items of the annotations use world coordinates (0.0 - 1.0) or they default to using axes coordinates (data indexes for category axis or data values for numeric axis).
*/
get itemsUseWorldCoordinates() {
return this.i.acp;
}
set itemsUseWorldCoordinates(v) {
this.i.acp = ensureBool(v);
}
/**
* Gets or sets location of the overlay text in relation to shape of data annotation.
*/
get overlayTextLocation() {
return this.i.acd;
}
set overlayTextLocation(v) {
this.i.acd = 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.ac9;
}
set overlayTextHorizontalMargin(v) {
this.i.ac9 = +v;
}
/**
* Gets or sets the vertical margin of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalMargin() {
return this.i.adb;
}
set overlayTextVerticalMargin(v) {
this.i.adb = +v;
}
/**
* Gets or sets the horizontal padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextHorizontalPadding() {
return this.i.ada;
}
set overlayTextHorizontalPadding(v) {
this.i.ada = +v;
}
/**
* Gets or sets the vertical padding of the overlay text in relation to shape of data annotation.
*/
get overlayTextVerticalPadding() {
return this.i.adc;
}
set overlayTextVerticalPadding(v) {
this.i.adc = +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.ac3;
}
set overlayTextAngle(v) {
this.i.ac3 = +v;
}
/**
* Gets or sets the color the overlay text.
*/
get overlayTextColor() {
return brushToString(this.i.afd);
}
set overlayTextColor(v) {
this.i.afd = stringToBrush(v);
}
/**
* Gets or sets the background the overlay text.
*/
get overlayTextBackground() {
return brushToString(this.i.afb);
}
set overlayTextBackground(v) {
this.i.afb = stringToBrush(v);
}
/**
* Gets or sets the border stroke of the overlay text.
*/
get overlayTextBorderColor() {
return brushToString(this.i.afc);
}
set overlayTextBorderColor(v) {
this.i.afc = stringToBrush(v);
}
/**
* Gets or sets the border corner of the overlay text.
*/
get overlayTextBorderRadius() {
return this.i.ac5;
}
set overlayTextBorderRadius(v) {
this.i.ac5 = +v;
}
/**
* Gets or sets the border thickness of the overlay text.
*/
get overlayTextBorderThickness() {
return this.i.ac7;
}
set overlayTextBorderThickness(v) {
this.i.ac7 = +v;
}
/**
* Gets or sets whether the overlay text is visible in shape of data annotation
*/
get overlayTextVisible() {
return this.i.act;
}
set overlayTextVisible(v) {
this.i.act = ensureBool(v);
}
/**
* Gets or sets name of data column with text that will be displayed as overlay text.
*/
get overlayTextMemberPath() {
return this.i.ad5;
}
set overlayTextMemberPath(v) {
this.i.ad5 = v;
}
/**
* Gets or sets the text that will be displayed as the overlay annotation.
*/
get overlayText() {
return this.i.adl;
}
set overlayText(v) {
this.i.adl = 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.ac8;
}
set overlayTextColorShift(v) {
this.i.ac8 = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextColorMode() {
return this.i.ab6;
}
set overlayTextColorMode(v) {
this.i.ab6 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text color matches brush of the layer
*/
get overlayTextColorMatchLayer() {
return this.i.acs;
}
set overlayTextColorMatchLayer(v) {
this.i.acs = 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.ac4;
}
set overlayTextBackgroundShift(v) {
this.i.ac4 = +v;
}
/**
* Gets or sets the mode used for shifting the background of overlay text based on the target series.
*/
get overlayTextBackgroundMode() {
return this.i.ab4;
}
set overlayTextBackgroundMode(v) {
this.i.ab4 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text background matches brush of the layer
*/
get overlayTextBackgroundMatchLayer() {
return this.i.acq;
}
set overlayTextBackgroundMatchLayer(v) {
this.i.acq = 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.ac6;
}
set overlayTextBorderShift(v) {
this.i.ac6 = +v;
}
/**
* Gets or sets the mode used for shifting the border of overlay text based on the target series.
*/
get overlayTextBorderMode() {
return this.i.ab5;
}
set overlayTextBorderMode(v) {
this.i.ab5 = ensureEnum(AnnotationAppearanceMode_$type, v);
}
/**
* Gets or sets whether the overlay text border matches brush of the layer
*/
get overlayTextBorderMatchLayer() {
return this.i.acr;
}
set overlayTextBorderMatchLayer(v) {
this.i.acr = ensureBool(v);
}
/**
* Gets or Sets the style to use for the display text.
*/
get overlayTextStyle() {
if (this.i.aci == null) {
return null;
}
return this.i.aci.fontString;
}
set overlayTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.aci = fi;
}
/**
* Gets whether the annotation layer is currently targeting horizontal axis.
*/
get isTargetingHorizontalAxis() {
return this.i.acm;
}
set isTargetingHorizontalAxis(v) {
this.i.acm = ensureBool(v);
}
/**
* Converts world coordinate (0.0 - 1.0) to pixel coordinate that is relative to component's size
*/
fromWorld(world) {
let iv = this.i.aff(toPoint(world));
return fromPoint(iv);
}
/**
* Converts world X coordinate (0.0 - 1.0) to pixel coordinate that is relative to component's width
*/
fromWorldX(x) {
let iv = this.i.ac0(x);
return (iv);
}
/**
* Converts world Y coordinate (0.0 - 1.0) to pixel coordinate that is relative to component's height
*/
fromWorldY(y) {
let iv = this.i.ac1(y);
return (iv);
}
/**
* Converts pixel coordinate (relative to component's size) to world coordinate (0.0 - 1.0)
*/
toWorld(pixel) {
let iv = this.i.afi(toPoint(pixel));
return fromPoint(iv);
}
/**
* Converts pixel X coordinate (relative to component's width) to world coordinate (0.0 - 1.0)
*/
toWorldX(x) {
let iv = this.i.add(x);
return (iv);
}
/**
* Converts pixel Y coordinate (relative to component's height) to world coordinate (0.0 - 1.0)
*/
toWorldY(y) {
let iv = this.i.ade(y);
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);
;
}
/**
* Event raised when updating style of annotation
*/
get stylingShapeAnnotation() {
return this._stylingShapeAnnotation;
}
set stylingShapeAnnotation(ev) {
if (this._stylingShapeAnnotation_wrapped !== null) {
this.i.stylingShapeAnnotation = delegateRemove(this.i.stylingShapeAnnotation, this._stylingShapeAnnotation_wrapped);
this._stylingShapeAnnotation_wrapped = null;
this._stylingShapeAnnotation = null;
}
this._stylingShapeAnnotation = ev;
this._stylingShapeAnnotation_wrapped = (o, e) => {
let outerArgs = new IgrDataAnnotationItem();
outerArgs._provideImplementation(e);
if (this.beforeStylingShapeAnnotation) {
this.beforeStylingShapeAnnotation(this, outerArgs);
}
if (this._stylingShapeAnnotation) {
this._stylingShapeAnnotation(this, outerArgs);
}
};
this.i.stylingShapeAnnotation = delegateCombine(this.i.stylingShapeAnnotation, this._stylingShapeAnnotation_wrapped);
;
}
/**
* Event raised when updating style of annotation
*/
get stylingAxisAnnotation() {
return this._stylingAxisAnnotation;
}
set stylingAxisAnnotation(ev) {
if (this._stylingAxisAnnotation_wrapped !== null) {
this.i.stylingAxisAnnotation = delegateRemove(this.i.stylingAxisAnnotation, this._stylingAxisAnnotation_wrapped);
this._stylingAxisAnnotation_wrapped = null;
this._stylingAxisAnnotation = null;
}
this._stylingAxisAnnotation = ev;
this._stylingAxisAnnotation_wrapped = (o, e) => {
let outerArgs = new IgrDataAnnotationInfo();
outerArgs._provideImplementation(e);
if (this.beforeStylingAxisAnnotation) {
this.beforeStylingAxisAnnotation(this, outerArgs);
}
if (this._stylingAxisAnnotation) {
this._stylingAxisAnnotation(this, outerArgs);
}
};
this.i.stylingAxisAnnotation = delegateCombine(this.i.stylingAxisAnnotation, this._stylingAxisAnnotation_wrapped);
;
}
}