UNPKG

igniteui-webcomponents-charts

Version:

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

135 lines (134 loc) 4.99 kB
import { IgcLegendBaseComponent } from './igc-legend-base-component'; import { ItemLegend } from "./ItemLegend"; import { LegendOrientation_$type } from './LegendOrientation'; import { WebComponentRenderer } from "igniteui-webcomponents-core"; import { DataChartStylingDefaults } from './DataChartStylingDefaults'; import { ensureEnum, toSpinal, enumToString, getAllPropertyNames } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-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` */ export let IgcItemLegendComponent = /*@__PURE__*/ (() => { class IgcItemLegendComponent extends IgcLegendBaseComponent { initializeContent() { } constructor() { super(); this._disconnected = false; let 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 WebComponentRenderer(root, document, true, DataChartStylingDefaults); this.container = ren.getWrapper(container); this._wrapper = ren; this.i.provideContainer(ren); } destroy() { this._wrapper.destroy(); this.i.provideContainer(null); } createImplementation() { return new ItemLegend(); } get i() { return this._implementation; } createItemwiseLegendItems(legendItems, series) { this.i.createItemwiseLegendItems(legendItems, series); } exportVisualData() { return this.i.exportVisualData(); } exportSerializedVisualData() { return this.i.exportSerializedVisualData(); } disconnectedCallback() { this._disconnected = true; if (this.i) { this.i.onDetachedFromUI(); } } connectedCallback() { if (this._disconnected) { this._disconnected = false; if (this.i) { this.i.onAttachedToUI(); } return; } this.classList.add("ig-item-legend"); this.classList.add("igc-item-legend"); this.appendChild(this._wrapper.rootWrapper.getNativeElement()); this._attached = true; this.style.display = "block"; // this.style.height = this._height; //this.style.width = this._width; this._flushQueuedAttributes(); // supports themes or custom properties set in CSS //this._styling(this, this); this.initializeContent(); } static get observedAttributes() { if (IgcItemLegendComponent._observedAttributesIgcItemLegendComponent == null) { let names = getAllPropertyNames(IgcItemLegendComponent); for (let i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcItemLegendComponent._observedAttributesIgcItemLegendComponent = names; } return IgcItemLegendComponent._observedAttributesIgcItemLegendComponent; } static register() { if (!IgcItemLegendComponent._isElementRegistered) { IgcItemLegendComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcItemLegendComponent.htmlTagName, IgcItemLegendComponent); } } /** * Gets whether or not this legend supports itemwise visuals */ get isItemwise() { return this.i.isItemwise; } /** * Gets or sets the current Legend object's orientation. */ get orientation() { return this.i.be; } set orientation(v) { this.i.be = ensureEnum(LegendOrientation_$type, v); this._a("orientation", enumToString(LegendOrientation_$type, this.i.be)); } /** * Gets or sets color of text */ get textColor() { return this.i.bk; } set textColor(v) { this.i.bk = v; } /** * Gets or sets style of text. */ get textStyle() { return this.i.bl; } set textStyle(v) { this.i.bl = v; } } IgcItemLegendComponent._observedAttributesIgcItemLegendComponent = null; IgcItemLegendComponent.htmlTagName = "igc-item-legend"; IgcItemLegendComponent._isElementRegistered = false; return IgcItemLegendComponent; })();