UNPKG

igniteui-react-charts

Version:

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

60 lines (59 loc) 1.76 kB
import * as React from 'react'; import { IgrLegendBase } from './igr-legend-base'; import { Legend } from "./Legend"; import { ReactRenderer } from "igniteui-react-core"; import { DataChartStylingDefaults } from './DataChartStylingDefaults'; /** * Represents a legend that displays information about each series, most often used in financial charting. */ export class IgrFinancialLegend extends IgrLegendBase { render() { let div = React.createElement("div", { className: "ig-financial-legend igr-financial-legend", ref: this._getMainRef }); return div; } _getMainRef(div) { this._elRef = div; } componentDidMount() { super.componentDidMount(); this.initializeContent(); } initializeContent() { this._elRef.appendChild(this.container.getNativeElement()); } constructor(props) { super(props); 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 ReactRenderer(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 Legend(); } get i() { return this._implementation; } /** * Gets if the legend is a financial legend. */ get isFinancial() { return this.i.isFinancial; } }