UNPKG

igniteui-react-charts

Version:

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

140 lines (139 loc) 4.53 kB
import { __extends } from "tslib"; import * as React from 'react'; import { IgrLegendBase } from './igr-legend-base'; import { ItemLegend } from "./ItemLegend"; import { LegendOrientation_$type } from './LegendOrientation'; import { ReactRenderer } from "igniteui-react-core"; import { DataChartStylingDefaults } from './DataChartStylingDefaults'; import { ensureEnum } from "igniteui-react-core"; /** * Represents a legend that displays an item for each point in the series. * * You can use the `ItemLegend` to display a legend item for each data member bound to the `BubbleSeries` * * ```ts * <IgrItemLegend ref={this.onLegendRef} /> * ``` * * ```ts * this.onLegendRef = this.onLegendRef.bind(this); * public onLegendRef(legend: IgrItemLegend) { * this.legend = legend; * if (this.chart) { * this.chart.actualSeries[0].legend = this.legend; * } * } * ``` */ var IgrItemLegend = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrItemLegend, _super); function IgrItemLegend(props) { var _this = _super.call(this, props) || this; _this._getMainRef = _this._getMainRef.bind(_this); var container; if (document) { container = document.createElement("div"); container.style.display = "block"; container.style.width = "100%"; container.style.height = "100%"; } var root; root = container; var ren = new ReactRenderer(root, document, true, DataChartStylingDefaults); _this.container = ren.getWrapper(container); _this._wrapper = ren; _this.i.provideContainer(ren); return _this; } IgrItemLegend.prototype.render = function () { var div = React.createElement("div", { className: "ig-item-legend igr-item-legend", ref: this._getMainRef }); return div; }; IgrItemLegend.prototype._getMainRef = function (div) { this._elRef = div; }; IgrItemLegend.prototype.componentDidMount = function () { _super.prototype.componentDidMount.call(this); this.initializeContent(); }; IgrItemLegend.prototype.initializeContent = function () { this._elRef.appendChild(this.container.getNativeElement()); }; IgrItemLegend.prototype.destroy = function () { this._wrapper.destroy(); this.i.provideContainer(null); }; IgrItemLegend.prototype.createImplementation = function () { return new ItemLegend(); }; Object.defineProperty(IgrItemLegend.prototype, "i", { get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgrItemLegend.prototype.createItemwiseLegendItems = function (legendItems, series) { this.i.createItemwiseLegendItems(legendItems, series); }; IgrItemLegend.prototype.exportVisualData = function () { return this.i.exportVisualData(); }; IgrItemLegend.prototype.exportSerializedVisualData = function () { return this.i.exportSerializedVisualData(); }; Object.defineProperty(IgrItemLegend.prototype, "isItemwise", { /** * Gets whether or not this legend supports itemwise visuals */ get: function () { return this.i.isItemwise; }, enumerable: false, configurable: true }); Object.defineProperty(IgrItemLegend.prototype, "orientation", { /** * Gets or sets the current Legend object's orientation. */ get: function () { return this.i.bh; }, set: function (v) { this.i.bh = ensureEnum(LegendOrientation_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrItemLegend.prototype, "textColor", { /** * Gets or sets color of text */ get: function () { return this.i.bn; }, set: function (v) { this.i.bn = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgrItemLegend.prototype, "textStyle", { /** * Gets or sets style of text. */ get: function () { return this.i.bo; }, set: function (v) { this.i.bo = v; }, enumerable: false, configurable: true }); return IgrItemLegend; }(IgrLegendBase)); export { IgrItemLegend };