igniteui-react-charts
Version:
Ignite UI React charting components for building rich data visualizations using TypeScript APIs.
1,635 lines (1,632 loc) • 51.3 kB
JavaScript
import * as React from 'react';
import { XamDataLegend } from "./XamDataLegend";
import { arrayFindByName, ensureEnum, brushToString, stringToBrush, ensureBool, initializePropertiesFromCss, NamePatcher, isValidProp, toSpinal, getModifiedProps } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
import { ReactRenderer } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { DataAbbreviationMode_$type } from "igniteui-react-core";
import { DataLegendHeaderTimeMode_$type } from "igniteui-react-core";
import { DataLegendHeaderDateMode_$type } from "igniteui-react-core";
import { DataLegendUnitsMode_$type } from "igniteui-react-core";
import { DataLegendLabelMode_$type } from "igniteui-react-core";
import { DataLegendValueMode_$type } from "igniteui-react-core";
import { DataLegendLayoutMode_$type } from "igniteui-react-core";
import { DataLegendSummaryType_$type } from "igniteui-react-core";
import { IgrDataLegendSummaryEventArgs } from './igr-data-legend-summary-event-args';
import { IgrDataLegendStylingRowEventArgs } from './igr-data-legend-styling-row-event-args';
import { IgrDataLegendStylingColumnEventArgs } from './igr-data-legend-styling-column-event-args';
import { LegendItemBadgeShape_$type } from "igniteui-react-core";
const DataLegendStylingDefaults = {};
/**
* Represents data legend that displays information about each series including values and summaries.
*/
export class IgrDataLegend extends React.Component {
set height(value) {
this._height = value;
if (this._elRef) {
this._elRef.style.height = value;
this._dataLegend.notifySizeChanged();
}
}
get height() {
return this._height;
}
set width(value) {
this._width = value;
if (this._elRef) {
this._elRef.style.height = value;
this._dataLegend.notifySizeChanged();
}
}
//private desiredSizeChanged(width: number, height: number) {
// //if (this.width == undefined || this.width == '') {
// // this._elRef.style.width = width + "px";
// //}
// //if (this.height == undefined || this.height == '') {
// // this._elRef.style.height = height + "px";
// //}
// //this._elRef.style.minWidth = width + "px";
// //this._elRef.style.minHeight = height + "px";
// this._dataLegend.notifySizeChanged();
//}
get width() {
return this._width;
}
_getMainRef(ref) {
this._elRef = ref;
}
render() {
let div = React.createElement("div", {
className: "ig-data-legend igr-data-legend",
ref: this._getMainRef
});
//}
return div;
}
constructor(props) {
super(props);
this._wrapper = null;
this._implementation = null;
this.__p = null;
this._hasUserValues = new Set();
this._stylingContainer = null;
this._stylingParent = null;
this._inStyling = false;
this._calculateColumnSummary = null;
this._calculateColumnSummary_wrapped = null;
this._styleHeaderRow = null;
this._styleHeaderRow_wrapped = null;
this._styleGroupRow = null;
this._styleGroupRow_wrapped = null;
this._styleSeriesRow = null;
this._styleSeriesRow_wrapped = null;
this._styleSummaryRow = null;
this._styleSummaryRow_wrapped = null;
this._styleSeriesColumn = null;
this._styleSeriesColumn_wrapped = null;
this._styleSummaryColumn = null;
this._styleSummaryColumn_wrapped = null;
if (this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
}
this._getMainRef = this._getMainRef.bind(this);
this._implementation = this.createImplementation();
if (document) {
this._container = document.createElement("div");
this._container.style.display = "block";
this._container.style.width = "100%";
this._container.style.height = "100%";
}
var root;
root = this._container;
if (this._container != null) {
root = this._container;
}
var ren = new ReactRenderer(root, document, true, DataLegendStylingDefaults);
this._wrapper = ren;
var dataLegend = this.i;
this._dataLegend = dataLegend;
this._dataLegend.externalObject = this;
dataLegend.provideContainer(ren);
dataLegend.notifySizeChanged();
if (props) {
this.initializeProperties();
}
ren.addSizeWatcher(() => {
this._dataLegend.notifySizeChanged();
});
}
shouldComponentUpdate(nextProps, nextState) {
const mod = getModifiedProps(this.props, nextProps);
for (const p of Object.keys(mod)) {
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
return true;
}
initializeProperties() {
for (const p of Object.keys(this.props)) {
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
// supports angular themes or custom properties set in CSS
updateStyle() {
this._styling(this._elRef, this);
}
destroy() {
this._dataLegend.destroy();
this._wrapper.destroy();
}
componentWillUnmount() {
}
componentDidMount() {
this._elRef.style.width = this._width ? this._width : "";
this._elRef.style.height = this._height ? this._height : "";
this._elRef.appendChild(this._container);
this._dataLegend.notifySizeChanged();
this.initializeContent();
}
initializeContent() {
this.updateStyle();
}
createImplementation() {
return new XamDataLegend();
}
get i() {
return this._implementation;
}
static _staticStyling(container, component, parent) {
let genericPrefix = "";
let typeName = (component.i ? component.i : component).$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("DataLegend");
let additionalPrefixes = [];
let prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
let b = (component.i ? component.i : component).$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
let basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
let parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
let parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, component, genericPrefix + "-", new Set(), false, additionalPrefixes);
}
/**
* Gets or sets the target for the data legend.
*/
get target() {
var ret = this.i.target;
if (!ret) {
return ret;
}
if (ret.externalObject != null) {
ret = ret.externalObject;
}
return ret;
}
set target(v) {
if (v && v._implementation) {
v = v._implementation;
}
this.i.target = v;
}
/**
* Gets whether or not at least one badge is visible based on BadgesShape and setting of a row's IsVisble in StyleSeriesRow event
*/
get actualBadgesVisible() {
return this.i.b0;
}
set actualBadgesVisible(v) {
this.i.b0 = ensureBool(v);
}
/**
* Gets the actual pixel scaling ratio used to affect the pixel density of the control.
* A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control to appear blurry.
*/
get actualPixelScalingRatio() {
return this.i.cs;
}
set actualPixelScalingRatio(v) {
this.i.cs = +v;
}
/**
* Gets the effective background of the data legend.
*/
get actualBackground() {
return brushToString(this.i.i3);
}
set actualBackground(v) {
this.i.i3 = stringToBrush(v);
}
/**
* Gets the effective border brush of the data legend.
*/
get actualBorderBrush() {
return brushToString(this.i.i4);
}
set actualBorderBrush(v) {
this.i.i4 = stringToBrush(v);
}
get actualBorderThicknessBottom() {
return this.i.jq ? this.i.jq.bottom : NaN;
}
set actualBorderThicknessBottom(v) {
this.ensureActualBorderThickness();
this.i.jq.bottom = +v;
this.i.jq = this.i.jq;
}
get actualBorderThicknessLeft() {
return this.i.jq ? this.i.jq.left : NaN;
}
set actualBorderThicknessLeft(v) {
this.ensureActualBorderThickness();
this.i.jq.left = +v;
this.i.jq = this.i.jq;
}
get actualBorderThicknessRight() {
return this.i.jq ? this.i.jq.right : NaN;
}
set actualBorderThicknessRight(v) {
this.ensureActualBorderThickness();
this.i.jq.right = +v;
this.i.jq = this.i.jq;
}
get actualBorderThicknessTop() {
return this.i.jq ? this.i.jq.top : NaN;
}
set actualBorderThicknessTop(v) {
this.ensureActualBorderThickness();
this.i.jq.top = +v;
this.i.jq = this.i.jq;
}
ensureActualBorderThickness() {
if (this.i.jq) {
return;
}
this.i.jq = new Thickness(2);
}
/**
* Gets or sets whether the legend is embedded in a DataTooltip
*/
get isEmbeddedInDataTooltip() {
return this.i.isEmbeddedInDataTooltip;
}
set isEmbeddedInDataTooltip(v) {
this.i.isEmbeddedInDataTooltip = ensureBool(v);
}
/**
* Gets or sets indexes, titles, or names of series to include in displaying in the data legend, e.g. "0, 1" or "Series1 Title, Series2 Title"
* The ExcludedSeries property takes precedence over values of IncludedSeries property
*/
get includedSeries() {
return this.i.includedSeries;
}
set includedSeries(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.includedSeries = v;
}
/**
* Gets or sets indexes, titles, or names of series to exclude from displaying in the data legend, e.g. "0, 1" or "Series1 Title, Series2 Title"
* The ExcludedSeries property takes precedence over values of IncludedSeries property
*/
get excludedSeries() {
return this.i.excludedSeries;
}
set excludedSeries(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.excludedSeries = v;
}
/**
* Gets or sets names of data columns or their labels to include in displaying in the data legend, e.g. "High, Low" or "H, L"
* The ExcludedColumns property takes precedence over values of IncludedColumns property
*/
get includedColumns() {
return this.i.includedColumns;
}
set includedColumns(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.includedColumns = v;
}
/**
* Gets or sets names of data columns or their labels to exclude from displaying in the data legend, e.g. "High, Low" or "H, L"
* The ExcludedColumns property takes precedence over values of IncludedColumns property
*/
get excludedColumns() {
return this.i.excludedColumns;
}
set excludedColumns(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.excludedColumns = v;
}
/**
* Gets or sets whether the data legend should update when the series data is mutated.
*/
get shouldUpdateWhenSeriesDataChanges() {
return this.i.b9;
}
set shouldUpdateWhenSeriesDataChanges(v) {
this.i.b9 = ensureBool(v);
}
/**
* Gets or sets mode for abbreviating large numbers displayed in the legend
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatAbbreviation() {
return this.i.an;
}
set valueFormatAbbreviation(v) {
this.i.an = ensureEnum(DataAbbreviationMode_$type, v);
}
/**
* Gets or sets maximum digits for formatting numbers displayed in the legend
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatMaxFractions() {
return this.i.cz;
}
set valueFormatMaxFractions(v) {
this.i.cz = +v;
}
/**
* Gets or sets minimum digits for formatting numbers displayed in the legend
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatMinFractions() {
return this.i.c0;
}
set valueFormatMinFractions(v) {
this.i.c0 = +v;
}
/**
* Gets or sets the mode for displaying values in the data legend, e.g. Currency ($500.25), Decimal (500.25), Integer (500)
*/
get valueFormatMode() {
return this.i.a5;
}
set valueFormatMode(v) {
this.i.a5 = ensureEnum(DataLegendValueMode_$type, v);
}
/**
* Gets or sets globalization culture when displaying values as currencies, e.g. use "en-GB" to display British pound symbol when the ValueFormatMode property is set to 'Currency' mode
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatCulture() {
return this.i.ff;
}
set valueFormatCulture(v) {
this.i.ff = v;
}
/**
* Gets or sets the currency code used for displaying currency symbol next to values, e.g. USD for $, EUR for €
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatCurrencyCode() {
return this.i.fh;
}
set valueFormatCurrencyCode(v) {
this.i.fh = v;
}
/**
* Gets or sets whether or not use grouping separator, e.g, 15,000 for 15000
* This property is ignored when setting ValueFormatSpecifiers or ValueFormatString properties
*/
get valueFormatUseGrouping() {
return this.i.ca;
}
set valueFormatUseGrouping(v) {
this.i.ca = ensureBool(v);
}
/**
* Gets or sets the format string for values displayed in the data legend.
*/
get valueFormatString() {
return this.i.fn;
}
set valueFormatString(v) {
this.i.fn = v;
}
/**
* Gets or sets the format specifiers to use with the ValueFormatString string.
*/
get valueFormatSpecifiers() {
return this.i.ah;
}
set valueFormatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.ah = v;
}
get valueRowMarginBottom() {
return this.i.j3 ? this.i.j3.bottom : NaN;
}
set valueRowMarginBottom(v) {
this.ensureValueRowMargin();
this.i.j3.bottom = +v;
this.i.j3 = this.i.j3;
}
get valueRowMarginLeft() {
return this.i.j3 ? this.i.j3.left : NaN;
}
set valueRowMarginLeft(v) {
this.ensureValueRowMargin();
this.i.j3.left = +v;
this.i.j3 = this.i.j3;
}
get valueRowMarginRight() {
return this.i.j3 ? this.i.j3.right : NaN;
}
set valueRowMarginRight(v) {
this.ensureValueRowMargin();
this.i.j3.right = +v;
this.i.j3 = this.i.j3;
}
get valueRowMarginTop() {
return this.i.j3 ? this.i.j3.top : NaN;
}
set valueRowMarginTop(v) {
this.ensureValueRowMargin();
this.i.j3.top = +v;
this.i.j3 = this.i.j3;
}
ensureValueRowMargin() {
if (this.i.j3) {
return;
}
this.i.j3 = new Thickness(2);
}
/**
* Gets or sets whether to show series rows.
*/
get valueRowVisible() {
return this.i.cb;
}
set valueRowVisible(v) {
this.i.cb = ensureBool(v);
}
/**
* Gets or sets text displayed when data column is missing a value, e.g. "no data"
*/
get valueTextWhenMissingData() {
return this.i.fw;
}
set valueTextWhenMissingData(v) {
this.i.fw = v;
}
/**
* Gets or sets whether to use series colors when displaying values in the legend
*/
get valueTextUseSeriesColors() {
return this.i.cc;
}
set valueTextUseSeriesColors(v) {
this.i.cc = ensureBool(v);
}
get valueTextMarginBottom() {
return this.i.j4 ? this.i.j4.bottom : NaN;
}
set valueTextMarginBottom(v) {
this.ensureValueTextMargin();
this.i.j4.bottom = +v;
this.i.j4 = this.i.j4;
}
get valueTextMarginLeft() {
return this.i.j4 ? this.i.j4.left : NaN;
}
set valueTextMarginLeft(v) {
this.ensureValueTextMargin();
this.i.j4.left = +v;
this.i.j4 = this.i.j4;
}
get valueTextMarginRight() {
return this.i.j4 ? this.i.j4.right : NaN;
}
set valueTextMarginRight(v) {
this.ensureValueTextMargin();
this.i.j4.right = +v;
this.i.j4 = this.i.j4;
}
get valueTextMarginTop() {
return this.i.j4 ? this.i.j4.top : NaN;
}
set valueTextMarginTop(v) {
this.ensureValueTextMargin();
this.i.j4.top = +v;
this.i.j4 = this.i.j4;
}
ensureValueTextMargin() {
if (this.i.j4) {
return;
}
this.i.j4 = new Thickness(2);
}
/**
* Gets or sets the units text color.
*/
get valueTextColor() {
return brushToString(this.i.jj);
}
set valueTextColor(v) {
this.i.jj = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the units text.
*/
get valueTextStyle() {
if (this.i.bx == null) {
return null;
}
return this.i.bx.fontString;
}
set valueTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bx = fi;
}
/**
* Gets or sets the format string for header text displayed in the data legend.
*/
get headerFormatString() {
return this.i.du;
}
set headerFormatString(v) {
this.i.du = v;
}
/**
* Gets or sets the format specifiers to use with the HeaderFormatString string.
*/
get headerFormatSpecifiers() {
return this.i.ag;
}
set headerFormatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.ag = v;
}
/**
* Gets or sets globalization culture applied to header only when it displays dates that are fetched from date/time axes
* This property is ignored when setting HeaderFormatSpecifiers or HeaderFormatString properties
*/
get headerFormatCulture() {
return this.i.dq;
}
set headerFormatCulture(v) {
this.i.dq = v;
}
/**
* Gets or sets date format for the header only when it displays dates that are fetched from date/time axes
* This property is ignored when setting HeaderFormatSpecifiers or HeaderFormatString properties
*/
get headerFormatDate() {
return this.i.ap;
}
set headerFormatDate(v) {
this.i.ap = ensureEnum(DataLegendHeaderDateMode_$type, v);
}
/**
* Gets or sets time format for the header only when it displays dates that are fetched from date/time axes
* This property is ignored when setting HeaderFormatSpecifiers or HeaderFormatString properties
*/
get headerFormatTime() {
return this.i.aq;
}
set headerFormatTime(v) {
this.i.aq = ensureEnum(DataLegendHeaderTimeMode_$type, v);
}
/**
* Gets or sets the HeaderText for the data legend.
*/
get headerText() {
return this.i.dz;
}
set headerText(v) {
this.i.dz = v;
}
/**
* Gets or sets the header text color.
*/
get headerTextColor() {
return brushToString(this.i.ja);
}
set headerTextColor(v) {
this.i.ja = stringToBrush(v);
}
get headerTextMarginBottom() {
return this.i.jw ? this.i.jw.bottom : NaN;
}
set headerTextMarginBottom(v) {
this.ensureHeaderTextMargin();
this.i.jw.bottom = +v;
this.i.jw = this.i.jw;
}
get headerTextMarginLeft() {
return this.i.jw ? this.i.jw.left : NaN;
}
set headerTextMarginLeft(v) {
this.ensureHeaderTextMargin();
this.i.jw.left = +v;
this.i.jw = this.i.jw;
}
get headerTextMarginRight() {
return this.i.jw ? this.i.jw.right : NaN;
}
set headerTextMarginRight(v) {
this.ensureHeaderTextMargin();
this.i.jw.right = +v;
this.i.jw = this.i.jw;
}
get headerTextMarginTop() {
return this.i.jw ? this.i.jw.top : NaN;
}
set headerTextMarginTop(v) {
this.ensureHeaderTextMargin();
this.i.jw.top = +v;
this.i.jw = this.i.jw;
}
ensureHeaderTextMargin() {
if (this.i.jw) {
return;
}
this.i.jw = new Thickness(2);
}
get headerRowMarginBottom() {
return this.i.jv ? this.i.jv.bottom : NaN;
}
set headerRowMarginBottom(v) {
this.ensureHeaderRowMargin();
this.i.jv.bottom = +v;
this.i.jv = this.i.jv;
}
get headerRowMarginLeft() {
return this.i.jv ? this.i.jv.left : NaN;
}
set headerRowMarginLeft(v) {
this.ensureHeaderRowMargin();
this.i.jv.left = +v;
this.i.jv = this.i.jv;
}
get headerRowMarginRight() {
return this.i.jv ? this.i.jv.right : NaN;
}
set headerRowMarginRight(v) {
this.ensureHeaderRowMargin();
this.i.jv.right = +v;
this.i.jv = this.i.jv;
}
get headerRowMarginTop() {
return this.i.jv ? this.i.jv.top : NaN;
}
set headerRowMarginTop(v) {
this.ensureHeaderRowMargin();
this.i.jv.top = +v;
this.i.jv = this.i.jv;
}
ensureHeaderRowMargin() {
if (this.i.jv) {
return;
}
this.i.jv = new Thickness(2);
}
/**
* Gets or sets whether to show Header row.
*/
get headerRowVisible() {
return this.i.b5;
}
set headerRowVisible(v) {
this.i.b5 = ensureBool(v);
}
/**
* Gets or Sets the style to use for the header text.
*/
get headerTextStyle() {
if (this.i.bp == null) {
return null;
}
return this.i.bp.fontString;
}
set headerTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bp = fi;
}
/**
* Gets or sets whether to show Header row.
*/
get groupRowVisible() {
return this.i.b3;
}
set groupRowVisible(v) {
this.i.b3 = ensureBool(v);
}
/**
* Gets or sets the Group text color.
*/
get groupTextColor() {
return brushToString(this.i.i9);
}
set groupTextColor(v) {
this.i.i9 = stringToBrush(v);
}
get groupTextMarginBottom() {
return this.i.ju ? this.i.ju.bottom : NaN;
}
set groupTextMarginBottom(v) {
this.ensureGroupTextMargin();
this.i.ju.bottom = +v;
this.i.ju = this.i.ju;
}
get groupTextMarginLeft() {
return this.i.ju ? this.i.ju.left : NaN;
}
set groupTextMarginLeft(v) {
this.ensureGroupTextMargin();
this.i.ju.left = +v;
this.i.ju = this.i.ju;
}
get groupTextMarginRight() {
return this.i.ju ? this.i.ju.right : NaN;
}
set groupTextMarginRight(v) {
this.ensureGroupTextMargin();
this.i.ju.right = +v;
this.i.ju = this.i.ju;
}
get groupTextMarginTop() {
return this.i.ju ? this.i.ju.top : NaN;
}
set groupTextMarginTop(v) {
this.ensureGroupTextMargin();
this.i.ju.top = +v;
this.i.ju = this.i.ju;
}
ensureGroupTextMargin() {
if (this.i.ju) {
return;
}
this.i.ju = new Thickness(2);
}
get groupRowMarginBottom() {
return this.i.jt ? this.i.jt.bottom : NaN;
}
set groupRowMarginBottom(v) {
this.ensureGroupRowMargin();
this.i.jt.bottom = +v;
this.i.jt = this.i.jt;
}
get groupRowMarginLeft() {
return this.i.jt ? this.i.jt.left : NaN;
}
set groupRowMarginLeft(v) {
this.ensureGroupRowMargin();
this.i.jt.left = +v;
this.i.jt = this.i.jt;
}
get groupRowMarginRight() {
return this.i.jt ? this.i.jt.right : NaN;
}
set groupRowMarginRight(v) {
this.ensureGroupRowMargin();
this.i.jt.right = +v;
this.i.jt = this.i.jt;
}
get groupRowMarginTop() {
return this.i.jt ? this.i.jt.top : NaN;
}
set groupRowMarginTop(v) {
this.ensureGroupRowMargin();
this.i.jt.top = +v;
this.i.jt = this.i.jt;
}
ensureGroupRowMargin() {
if (this.i.jt) {
return;
}
this.i.jt = new Thickness(2);
}
/**
* Gets or Sets the style to use for the Group text.
*/
get groupTextStyle() {
if (this.i.bo == null) {
return null;
}
return this.i.bo.fontString;
}
set groupTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bo = fi;
}
/**
* Gets or sets the summary text color.
*/
get summaryTitleTextColor() {
return brushToString(this.i.je);
}
set summaryTitleTextColor(v) {
this.i.je = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the summary text.
*/
get summaryTitleTextStyle() {
if (this.i.bs == null) {
return null;
}
return this.i.bs.fontString;
}
set summaryTitleTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bs = fi;
}
/**
* Gets or sets the SummaryType for the data legend.
*/
get summaryType() {
return this.i.a3;
}
set summaryType(v) {
this.i.a3 = ensureEnum(DataLegendSummaryType_$type, v);
}
/**
* Gets or sets the SummaryTitleText for the data legend.
*/
get summaryTitleText() {
return this.i.eq;
}
set summaryTitleText(v) {
this.i.eq = v;
}
get summaryTitleTextMarginBottom() {
return this.i.jz ? this.i.jz.bottom : NaN;
}
set summaryTitleTextMarginBottom(v) {
this.ensureSummaryTitleTextMargin();
this.i.jz.bottom = +v;
this.i.jz = this.i.jz;
}
get summaryTitleTextMarginLeft() {
return this.i.jz ? this.i.jz.left : NaN;
}
set summaryTitleTextMarginLeft(v) {
this.ensureSummaryTitleTextMargin();
this.i.jz.left = +v;
this.i.jz = this.i.jz;
}
get summaryTitleTextMarginRight() {
return this.i.jz ? this.i.jz.right : NaN;
}
set summaryTitleTextMarginRight(v) {
this.ensureSummaryTitleTextMargin();
this.i.jz.right = +v;
this.i.jz = this.i.jz;
}
get summaryTitleTextMarginTop() {
return this.i.jz ? this.i.jz.top : NaN;
}
set summaryTitleTextMarginTop(v) {
this.ensureSummaryTitleTextMargin();
this.i.jz.top = +v;
this.i.jz = this.i.jz;
}
ensureSummaryTitleTextMargin() {
if (this.i.jz) {
return;
}
this.i.jz = new Thickness(2);
}
get summaryRowMarginBottom() {
return this.i.jy ? this.i.jy.bottom : NaN;
}
set summaryRowMarginBottom(v) {
this.ensureSummaryRowMargin();
this.i.jy.bottom = +v;
this.i.jy = this.i.jy;
}
get summaryRowMarginLeft() {
return this.i.jy ? this.i.jy.left : NaN;
}
set summaryRowMarginLeft(v) {
this.ensureSummaryRowMargin();
this.i.jy.left = +v;
this.i.jy = this.i.jy;
}
get summaryRowMarginRight() {
return this.i.jy ? this.i.jy.right : NaN;
}
set summaryRowMarginRight(v) {
this.ensureSummaryRowMargin();
this.i.jy.right = +v;
this.i.jy = this.i.jy;
}
get summaryRowMarginTop() {
return this.i.jy ? this.i.jy.top : NaN;
}
set summaryRowMarginTop(v) {
this.ensureSummaryRowMargin();
this.i.jy.top = +v;
this.i.jy = this.i.jy;
}
ensureSummaryRowMargin() {
if (this.i.jy) {
return;
}
this.i.jy = new Thickness(2);
}
/**
* Gets or sets the units text color.
*/
get summaryValueTextColor() {
return brushToString(this.i.jg);
}
set summaryValueTextColor(v) {
this.i.jg = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the units text.
*/
get summaryValueTextStyle() {
if (this.i.bu == null) {
return null;
}
return this.i.bu.fontString;
}
set summaryValueTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bu = fi;
}
/**
* Gets or sets the units text for the data legend.
*/
get summaryLabelText() {
return this.i.el;
}
set summaryLabelText(v) {
this.i.el = v;
}
/**
* Gets or sets the units text color.
*/
get summaryLabelTextColor() {
return brushToString(this.i.jd);
}
set summaryLabelTextColor(v) {
this.i.jd = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the units text.
*/
get summaryLabelTextStyle() {
if (this.i.br == null) {
return null;
}
return this.i.br.fontString;
}
set summaryLabelTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.br = fi;
}
/**
* Gets or sets the units text for the data legend.
*/
get summaryUnitsText() {
return this.i.ew;
}
set summaryUnitsText(v) {
this.i.ew = v;
}
/**
* Gets or sets the units text color.
*/
get summaryUnitsTextColor() {
return brushToString(this.i.jf);
}
set summaryUnitsTextColor(v) {
this.i.jf = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the units text.
*/
get summaryUnitsTextStyle() {
if (this.i.bt == null) {
return null;
}
return this.i.bt.fontString;
}
set summaryUnitsTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bt = fi;
}
get badgeMarginBottom() {
return this.i.jr ? this.i.jr.bottom : NaN;
}
set badgeMarginBottom(v) {
this.ensureBadgeMargin();
this.i.jr.bottom = +v;
this.i.jr = this.i.jr;
}
get badgeMarginLeft() {
return this.i.jr ? this.i.jr.left : NaN;
}
set badgeMarginLeft(v) {
this.ensureBadgeMargin();
this.i.jr.left = +v;
this.i.jr = this.i.jr;
}
get badgeMarginRight() {
return this.i.jr ? this.i.jr.right : NaN;
}
set badgeMarginRight(v) {
this.ensureBadgeMargin();
this.i.jr.right = +v;
this.i.jr = this.i.jr;
}
get badgeMarginTop() {
return this.i.jr ? this.i.jr.top : NaN;
}
set badgeMarginTop(v) {
this.ensureBadgeMargin();
this.i.jr.top = +v;
this.i.jr = this.i.jr;
}
ensureBadgeMargin() {
if (this.i.jr) {
return;
}
this.i.jr = new Thickness(2);
}
/**
* Gets or sets the BadgeShape for the data legend.
*/
get badgeShape() {
return this.i.ba;
}
set badgeShape(v) {
this.i.ba = ensureEnum(LegendItemBadgeShape_$type, v);
}
/**
* Gets or sets horizontal position (between 0.0 and 1.0) in viewport of the target component
*/
get targetCursorPositionX() {
return this.i.targetCursorPositionX;
}
set targetCursorPositionX(v) {
this.i.targetCursorPositionX = +v;
}
/**
* Gets or sets vertical position (between 0.0 and 1.0) in viewport of the target component
*/
get targetCursorPositionY() {
return this.i.targetCursorPositionY;
}
set targetCursorPositionY(v) {
this.i.targetCursorPositionY = +v;
}
/**
* Gets or sets the UnitsMode for the data legend.
*/
get unitsDisplayMode() {
return this.i.a4;
}
set unitsDisplayMode(v) {
this.i.a4 = ensureEnum(DataLegendUnitsMode_$type, v);
}
/**
* Gets or sets the units text for the data legend.
*/
get unitsText() {
return this.i.e9;
}
set unitsText(v) {
this.i.e9 = v;
}
/**
* Gets or sets the units text color.
*/
get unitsTextColor() {
return brushToString(this.i.ji);
}
set unitsTextColor(v) {
this.i.ji = stringToBrush(v);
}
get unitsTextMarginBottom() {
return this.i.j1 ? this.i.j1.bottom : NaN;
}
set unitsTextMarginBottom(v) {
this.ensureUnitsTextMargin();
this.i.j1.bottom = +v;
this.i.j1 = this.i.j1;
}
get unitsTextMarginLeft() {
return this.i.j1 ? this.i.j1.left : NaN;
}
set unitsTextMarginLeft(v) {
this.ensureUnitsTextMargin();
this.i.j1.left = +v;
this.i.j1 = this.i.j1;
}
get unitsTextMarginRight() {
return this.i.j1 ? this.i.j1.right : NaN;
}
set unitsTextMarginRight(v) {
this.ensureUnitsTextMargin();
this.i.j1.right = +v;
this.i.j1 = this.i.j1;
}
get unitsTextMarginTop() {
return this.i.j1 ? this.i.j1.top : NaN;
}
set unitsTextMarginTop(v) {
this.ensureUnitsTextMargin();
this.i.j1.top = +v;
this.i.j1 = this.i.j1;
}
ensureUnitsTextMargin() {
if (this.i.j1) {
return;
}
this.i.j1 = new Thickness(2);
}
/**
* Gets or Sets the style to use for the units text.
*/
get unitsTextStyle() {
if (this.i.bw == null) {
return null;
}
return this.i.bw.fontString;
}
set unitsTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bw = fi;
}
get titleTextMarginBottom() {
return this.i.j0 ? this.i.j0.bottom : NaN;
}
set titleTextMarginBottom(v) {
this.ensureTitleTextMargin();
this.i.j0.bottom = +v;
this.i.j0 = this.i.j0;
}
get titleTextMarginLeft() {
return this.i.j0 ? this.i.j0.left : NaN;
}
set titleTextMarginLeft(v) {
this.ensureTitleTextMargin();
this.i.j0.left = +v;
this.i.j0 = this.i.j0;
}
get titleTextMarginRight() {
return this.i.j0 ? this.i.j0.right : NaN;
}
set titleTextMarginRight(v) {
this.ensureTitleTextMargin();
this.i.j0.right = +v;
this.i.j0 = this.i.j0;
}
get titleTextMarginTop() {
return this.i.j0 ? this.i.j0.top : NaN;
}
set titleTextMarginTop(v) {
this.ensureTitleTextMargin();
this.i.j0.top = +v;
this.i.j0 = this.i.j0;
}
ensureTitleTextMargin() {
if (this.i.j0) {
return;
}
this.i.j0 = new Thickness(2);
}
/**
* Gets or sets the display text color.
*/
get titleTextColor() {
return brushToString(this.i.jh);
}
set titleTextColor(v) {
this.i.jh = stringToBrush(v);
}
/**
* Gets or Sets the style to use for the display text.
*/
get titleTextStyle() {
if (this.i.bv == null) {
return null;
}
return this.i.bv.fontString;
}
set titleTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bv = fi;
}
/**
* Gets or sets the mode for displaying labels before series values in the data legend, e.g. O: H: L: C: for financial series
*/
get labelDisplayMode() {
return this.i.ar;
}
set labelDisplayMode(v) {
this.i.ar = ensureEnum(DataLegendLabelMode_$type, v);
}
/**
* Gets or sets the units text color.
*/
get labelTextColor() {
return brushToString(this.i.jb);
}
set labelTextColor(v) {
this.i.jb = stringToBrush(v);
}
get labelTextMarginBottom() {
return this.i.jx ? this.i.jx.bottom : NaN;
}
set labelTextMarginBottom(v) {
this.ensureLabelTextMargin();
this.i.jx.bottom = +v;
this.i.jx = this.i.jx;
}
get labelTextMarginLeft() {
return this.i.jx ? this.i.jx.left : NaN;
}
set labelTextMarginLeft(v) {
this.ensureLabelTextMargin();
this.i.jx.left = +v;
this.i.jx = this.i.jx;
}
get labelTextMarginRight() {
return this.i.jx ? this.i.jx.right : NaN;
}
set labelTextMarginRight(v) {
this.ensureLabelTextMargin();
this.i.jx.right = +v;
this.i.jx = this.i.jx;
}
get labelTextMarginTop() {
return this.i.jx ? this.i.jx.top : NaN;
}
set labelTextMarginTop(v) {
this.ensureLabelTextMargin();
this.i.jx.top = +v;
this.i.jx = this.i.jx;
}
ensureLabelTextMargin() {
if (this.i.jx) {
return;
}
this.i.jx = new Thickness(2);
}
/**
* Gets or Sets the style to use for the units text.
*/
get labelTextStyle() {
if (this.i.bq == null) {
return null;
}
return this.i.bq.fontString;
}
set labelTextStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.bq = fi;
}
/**
* Gets or sets the scaling value used to affect the pixel density of the control.
* A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control to appear blurry.
*/
get pixelScalingRatio() {
return this.i.pixelScalingRatio;
}
set pixelScalingRatio(v) {
this.i.pixelScalingRatio = +v;
}
/**
* Gets or sets the layout of content in the data legend
*/
get layoutMode() {
return this.i.as;
}
set layoutMode(v) {
this.i.as = ensureEnum(DataLegendLayoutMode_$type, v);
}
/**
* Gets or sets the background of the data legend.
*/
get contentBackground() {
return brushToString(this.i.i5);
}
set contentBackground(v) {
this.i.i5 = stringToBrush(v);
}
/**
* Gets or sets the border color of the data legend.
*/
get contentBorderBrush() {
return brushToString(this.i.i6);
}
set contentBorderBrush(v) {
this.i.i6 = stringToBrush(v);
}
/**
* Gets or sets the border thickness of the data legend.
*/
get contentBorderThickness() {
return this.i.cv;
}
set contentBorderThickness(v) {
this.i.cv = +v;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.valueFormatSpecifiers != null && arrayFindByName(this.valueFormatSpecifiers, name)) {
return arrayFindByName(this.valueFormatSpecifiers, name);
}
if (this.headerFormatSpecifiers != null && arrayFindByName(this.headerFormatSpecifiers, name)) {
return arrayFindByName(this.headerFormatSpecifiers, name);
}
return null;
}
get hasUserValues() {
return this._hasUserValues;
}
__m(propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
}
_styling(container, component, parent) {
if (this._inStyling) {
return;
}
this._inStyling = true;
this._stylingContainer = container;
this._stylingParent = component;
let genericPrefix = "";
let typeName = this.i.$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("DataLegend");
let additionalPrefixes = [];
let prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
let b = this.i.$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
let basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
let parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
let parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
}
/**
* Returns the legend visuals expressed as a serialized string.
*/
exportSerializedVisualData() {
let iv = this.i.exportSerializedVisualData();
return (iv);
}
/**
* Notifies the legend about changes to size
*/
notifySizeChanged() {
this.i.notifySizeChanged();
}
/**
* Forces any pending refresh to the legend to be finished.
*/
flush() {
this.i.flush();
}
getAbbreviatedNumber(number, mode, minDigits, maxDigits) {
let iv = this.i.cw(number, ensureEnum(DataAbbreviationMode_$type, mode), minDigits, maxDigits);
return (iv);
}
getAbbreviatedSymbol(number, mode, minDigits, maxDigits) {
let iv = this.i.dj(number, ensureEnum(DataAbbreviationMode_$type, mode), minDigits, maxDigits);
return (iv);
}
getAbbreviatedString(number, mode, minDigits, maxDigits) {
let iv = this.i.di(number, ensureEnum(DataAbbreviationMode_$type, mode), minDigits, maxDigits);
return (iv);
}
/**
* Event raised when calculating summary value for each column in data legend
*/
get calculateColumnSummary() {
return this._calculateColumnSummary;
}
set calculateColumnSummary(ev) {
if (this._calculateColumnSummary_wrapped !== null) {
this.i.calculateColumnSummary = delegateRemove(this.i.calculateColumnSummary, this._calculateColumnSummary_wrapped);
this._calculateColumnSummary_wrapped = null;
this._calculateColumnSummary = null;
}
this._calculateColumnSummary = ev;
this._calculateColumnSummary_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendSummaryEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeCalculateColumnSummary) {
this.beforeCalculateColumnSummary(this, outerArgs);
}
if (this._calculateColumnSummary) {
this._calculateColumnSummary(this, outerArgs);
}
};
this.i.calculateColumnSummary = delegateCombine(this.i.calculateColumnSummary, this._calculateColumnSummary_wrapped);
;
}
/**
* Event raised when styling the header row
*/
get styleHeaderRow() {
return this._styleHeaderRow;
}
set styleHeaderRow(ev) {
if (this._styleHeaderRow_wrapped !== null) {
this.i.styleHeaderRow = delegateRemove(this.i.styleHeaderRow, this._styleHeaderRow_wrapped);
this._styleHeaderRow_wrapped = null;
this._styleHeaderRow = null;
}
this._styleHeaderRow = ev;
this._styleHeaderRow_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendStylingRowEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStyleHeaderRow) {
this.beforeStyleHeaderRow(this, outerArgs);
}
if (this._styleHeaderRow) {
this._styleHeaderRow(this, outerArgs);
}
};
this.i.styleHeaderRow = delegateCombine(this.i.styleHeaderRow, this._styleHeaderRow_wrapped);
;
}
/**
* Event raised when styling the group row
*/
get styleGroupRow() {
return this._styleGroupRow;
}
set styleGroupRow(ev) {
if (this._styleGroupRow_wrapped !== null) {
this.i.styleGroupRow = delegateRemove(this.i.styleGroupRow, this._styleGroupRow_wrapped);
this._styleGroupRow_wrapped = null;
this._styleGroupRow = null;
}
this._styleGroupRow = ev;
this._styleGroupRow_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendStylingRowEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStyleGroupRow) {
this.beforeStyleGroupRow(this, outerArgs);
}
if (this._styleGroupRow) {
this._styleGroupRow(this, outerArgs);
}
};
this.i.styleGroupRow = delegateCombine(this.i.styleGroupRow, this._styleGroupRow_wrapped);
;
}
/**
* Event raised when styling title and badge in series rows
*/
get styleSeriesRow() {
return this._styleSeriesRow;
}
set styleSeriesRow(ev) {
if (this._styleSeriesRow_wrapped !== null) {
this.i.styleSeriesRow = delegateRemove(this.i.styleSeriesRow, this._styleSeriesRow_wrapped);
this._styleSeriesRow_wrapped = null;
this._styleSeriesRow = null;
}
this._styleSeriesRow = ev;
this._styleSeriesRow_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendStylingRowEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStyleSeriesRow) {
this.beforeStyleSeriesRow(this, outerArgs);
}
if (this._styleSeriesRow) {
this._styleSeriesRow(this, outerArgs);
}
};
this.i.styleSeriesRow = delegateCombine(this.i.styleSeriesRow, this._styleSeriesRow_wrapped);
;
}
/**
* Event raised when styling title in the summary row
*/
get styleSummaryRow() {
return this._styleSummaryRow;
}
set styleSummaryRow(ev) {
if (this._styleSummaryRow_wrapped !== null) {
this.i.styleSummaryRow = delegateRemove(this.i.styleSummaryRow, this._styleSummaryRow_wrapped);
this._styleSummaryRow_wrapped = null;
this._styleSummaryRow = null;
}
this._styleSummaryRow = ev;
this._styleSummaryRow_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendStylingRowEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStyleSummaryRow) {
this.beforeStyleSummaryRow(this, outerArgs);
}
if (this._styleSummaryRow) {
this._styleSummaryRow(this, outerArgs);
}
};
this.i.styleSummaryRow = delegateCombine(this.i.styleSummaryRow, this._styleSummaryRow_wrapped);
;
}
/**
* Event raised when styling the label, value, and unit columns in series rows
*/
get styleSeriesColumn() {
return this._styleSeriesColumn;
}
set styleSeriesColumn(ev) {
if (this._styleSeriesColumn_wrapped !== null) {
this.i.styleSeriesColumn = delegateRemove(this.i.styleSeriesColumn, this._styleSeriesColumn_wrapped);
this._styleSeriesColumn_wrapped = null;
this._styleSeriesColumn = null;
}
this._styleSeriesColumn = ev;
this._styleSeriesColumn_wrapped = (o, e) => {
let outerArgs = new IgrDataLegendStylingColumnEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeStyleSeriesColumn) {
this.beforeStyleSeriesColumn(this, outerArgs);
}
if (this._styleSeriesColumn) {
this._styleSeriesC