import * as tslib_1 from "tslib";
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { ReactRenderer, ReactWrapper } from "igniteui-react-core";
import { TypeRegistrar } from "igniteui-react-core";
import { FinancialChart } from './FinancialChart';
import { FinancialChartType_$type } from './FinancialChartType';
import { fromBrushCollection, toBrushCollection, brushToString, stringToBrush, ensureEnum, ensureBool } from "igniteui-react-core";
import { IgrXYChart } from './igr-xy-chart';
import { DataChartStylingDefaults } from './DataChartStylingDefaults';
import { DataSeriesType } from "igniteui-react-core";
import { IgrDataContext } from "igniteui-react-core";
import { FinancialChartVolumeType_$type } from './FinancialChartVolumeType';
import { FinancialChartXAxisMode, FinancialChartXAxisMode_$type } from './FinancialChartXAxisMode';
import { FinancialChartYAxisMode, FinancialChartYAxisMode_$type } from './FinancialChartYAxisMode';
import { HorizontalAlignment_$type } from "igniteui-react-core";
import { AxisLabelsLocation_$type } from './AxisLabelsLocation';
import { FinancialChartZoomSliderType_$type } from './FinancialChartZoomSliderType';
import { IgrFinancialChartDefaultTemplates } from './igr-financial-chart-default-templates';
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrFinancialIndicatorTypeCollection } from './igr-financial-indicator-type-collection';
import { FinancialIndicatorTypeCollection as FinancialIndicatorTypeCollection_internal } from './FinancialIndicatorTypeCollection';
import { SyncableObservableCollection$1 } from "igniteui-react-core";
import { FinancialIndicatorType_$type } from './FinancialIndicatorType';
import { IgrFinancialOverlayTypeCollection } from './igr-financial-overlay-type-collection';
import { FinancialOverlayTypeCollection as FinancialOverlayTypeCollection_internal } from './FinancialOverlayTypeCollection';
import { FinancialOverlayType_$type } from './FinancialOverlayType';
import { IgrIndicatorDisplayTypeCollection } from './igr-indicator-display-type-collection';
import { IndicatorDisplayTypeCollection as IndicatorDisplayTypeCollection_internal } from './IndicatorDisplayTypeCollection';
import { IndicatorDisplayType_$type } from './IndicatorDisplayType';
import { IgrFinancialChartRangeSelectorOptionCollection } from './igr-financial-chart-range-selector-option-collection';
import { FinancialChartRangeSelectorOptionCollection as FinancialChartRangeSelectorOptionCollection_internal } from './FinancialChartRangeSelectorOptionCollection';
import { FinancialChartRangeSelectorOption_$type } from './FinancialChartRangeSelectorOption';
import { IgrFinancialChartCustomIndicatorArgs } from './igr-financial-chart-custom-indicator-args';
import { CustomIndicatorNameCollection as CustomIndicatorNameCollection_internal } from './CustomIndicatorNameCollection';
import { IgrCustomIndicatorNameCollection } from './igr-custom-indicator-name-collection';
import { String_$type } from "igniteui-react-core";
import { IgrTemplateContainer } from "igniteui-react-core";
var fg = window && window.CSS && window.CSS.supports &&
    /*@__PURE__*/ window.CSS.supports("display", "grid");
var financialChartToolbarStyle = {
    gridRow: 1,
    msGridRow: 1
};
var financialChartPriceStyle = {
    gridRow: 3,
    msGridRow: 3
};
var financialChartIndicatorsStyle = {
    gridRow: 4,
    msGridRow: 4
};
var financialChartVolumeStyle = {
    gridRow: 5,
    msGridRow: 5
};
var financialChartZoomSliderStyle = {
    gridRow: 6,
    msGridRow: 6
};
var financialChartMainGridStyle = {
    height: '100%',
    width: '100%',
    textAlign: 'left',
    display: fg ? 'grid' : '-ms-grid',
    msGridColumns: '100%'
};
var financialChartLegendStyle = {
    gridRow: 2,
    msGridRow: 2
};
var IgrFinancialChart = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgrFinancialChart, _super);
    function IgrFinancialChart(props) {
        var _this = _super.call(this, props) || this;
        _this._wrapper = null;
        _this._initialized = false;
        _this._toolbarElement = null;
        _this._dataSource = null;
        _this._defaultTooltips = null;
        _this._dynamicContent = {};
        _this._uniqueTooltipId = 0;
        _this._xAxisBreaks = null;
        _this._indicatorTypes = null;
        _this._overlayTypes = null;
        _this._indicatorDisplayTypes = null;
        _this._rangeSelectorOptions = null;
        _this._customIndicatorNames = null;
        _this._applyCustomIndicators = null;
        _this._applyCustomIndicators_wrapped = null;
        _this._toolTemplateRef = _this._toolTemplateRef.bind(_this);
        _this._tooltipRef = _this._tooltipRef.bind(_this);
        _this._mainGridRef = _this._mainGridRef.bind(_this);
        _this._mainRef = _this._mainRef.bind(_this);
        _this._toolbarRef = _this._toolbarRef.bind(_this);
        _this._activeTooltipElements = new Map();
        _this._activeTooltips = new Map();
        _this._currentTooltips = [];
        _this.onDocumentClick = _this.onDocumentClick.bind(_this);
        if (document) {
            _this._container = document.createElement("div");
            _this._container.style.display = "block";
            _this._container.style.width = "100%";
            _this._container.style.height = "100%";
            document.addEventListener("click", _this.onDocumentClick);
        }
        var root;
        root = _this._container;
        if (_this._container != null) {
            root = _this._container;
        }
        var ren = new ReactRenderer(root, document, true, DataChartStylingDefaults);
        _this._wrapper = ren;
        var chart = _this.i;
        _this._chart = chart;
        if (chart.xAxis) {
            _this.rewrapAxis(chart.xAxis);
        }
        if (chart.yAxis) {
            _this.rewrapAxis(chart.yAxis);
        }
        if (chart.volumeAxis) {
            _this.rewrapAxis(chart.volumeAxis);
        }
        if (chart.volumeXAxis) {
            _this.rewrapAxis(chart.volumeXAxis);
        }
        if (chart.indicatorAxis) {
            _this.rewrapAxis(chart.indicatorAxis);
        }
        if (chart.indicatorXAxis) {
            _this.rewrapAxis(chart.indicatorXAxis);
        }
        if (chart.zoomSliderAxis) {
            _this.rewrapAxis(chart.zoomSliderAxis);
        }
        if (chart.zoomSliderXAxis) {
            _this.rewrapAxis(chart.zoomSliderXAxis);
        }
        chart.provideContainer(ren);
        _this.bindData();
        chart.notifyResized();
        ren.addSizeWatcher(function () {
            _this._checkToolbarSize();
            _this._chart.notifyResized();
        });
        _this._initialized = true;
        return _this;
    }
    IgrFinancialChart.prototype.render = function () {
        var outerChildren = [];
        var children = [
            React.createElement('div', {
                key: 'financialChartToolbarArea',
                className: 'financialChartToolbarArea',
                style: financialChartToolbarStyle,
                ref: this._toolbarRef
            }, React.createElement(IgrTemplateContainer, {
                ref: this._toolTemplateRef,
            })),
            React.createElement('div', { key: 'financialChartLegend', className: 'financialChartLegend', style: financialChartLegendStyle }),
            React.createElement('div', { key: 'financialChartPrice', className: 'financialChartPrice', style: financialChartPriceStyle }),
            React.createElement('div', { key: 'financialChartIndicators', className: 'financialChartIndicators', style: financialChartIndicatorsStyle }),
            React.createElement('div', { key: 'financialChartVolume', className: 'financialChartVolume', style: financialChartVolumeStyle }),
            React.createElement('div', { key: 'financialChartZoomSlider', className: 'financialChartZoomSlider', style: financialChartZoomSliderStyle })
        ];
        if (this._sliderPortal) {
            children.push(this._sliderPortal);
        }
        if (this._currentTooltips && this._currentTooltips.length > 0) {
            for (var i = 0; i < this._currentTooltips.length; i++) {
                var t = this._currentTooltips[i];
                if (this._activeTooltipElements.has(t)) {
                    var active = this._activeTooltipElements.get(t);
                    outerChildren.push(active);
                }
                else {
                    if (!TypeRegistrar.isRegistered("IgrTooltipContainer")) {
                        continue;
                    }
                    var Tooltip = TypeRegistrar.get("IgrTooltipContainer");
                    var tEle = React.createElement(Tooltip, {
                        ref: this._tooltipRef,
                        key: this._currentTooltips[i].key,
                        owner: this._currentTooltips[i]
                    });
                    var portal = ReactDOM.createPortal(tEle, t, this._currentTooltips[i].key);
                    this._activeTooltipElements.set(t, portal);
                    outerChildren.push(portal);
                }
            }
        }
        var mainGrid = React.createElement('div', {
            key: 'financialChartMainGrid',
            className: 'financialChartMainGrid',
            style: financialChartMainGridStyle,
            children: children,
            ref: this._mainGridRef,
        });
        outerChildren.splice(0, 0, mainGrid);
        var mainDiv = React.createElement('div', {
            className: "ig-financial-chart igr-financial-chart",
            key: "financialChartMainDiv",
            children: outerChildren,
            ref: this._mainRef
        });
        return mainDiv;
    };
    IgrFinancialChart.prototype._tooltipRef = function (t) {
        console.log(t);
        if (t === null) {
            return;
        }
        if (t.currentOwner &&
            t.currentOwner.tooltipTemplate) {
            t.template = t.currentOwner.tooltipTemplate;
        }
        this._activeTooltips.set(t.currentOwner, t);
    };
    IgrFinancialChart.prototype._toolbarRef = function (t) {
        this._toolbarElement = t;
    };
    IgrFinancialChart.prototype._toolTemplateRef = function (t) {
        this._toolbarTemplateComponent = t;
    };
    IgrFinancialChart.prototype._mainGridRef = function (t) {
        this._mainGridElement = t;
    };
    IgrFinancialChart.prototype._mainRef = function (t) {
        this._mainElement = t;
        this._container = t;
        if (!t) {
            return;
        }
        this._wrapper.updateRoot(this._wrapper.getWrapper(this._container));
    };
    Object.defineProperty(IgrFinancialChart.prototype, "height", {
        get: function () {
            return this._height;
        },
        set: function (value) {
            this._height = value;
            if (this._mainElement) {
                this._mainElement.style.height = value;
                this._chart.notifyResized();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "width", {
        get: function () {
            return this._width;
        },
        set: function (value) {
            this._width = value;
            if (this._mainElement) {
                this._mainElement.style.height = value;
                this._chart.notifyResized();
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "rangeSelectorTemplate", {
        get: function () {
            return this._rangeSelectorTemplate;
        },
        set: function (value) {
            this._rangeSelectorTemplate = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "chartTypePickerTemplate", {
        get: function () {
            return this._chartTypePickerTemplate;
        },
        set: function (value) {
            this._chartTypePickerTemplate = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorMenuTemplate", {
        get: function () {
            return this._indicatorMenuTemplate;
        },
        set: function (value) {
            this._indicatorMenuTemplate = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "toolbarTemplate", {
        get: function () {
            return this._toolbarTemplate;
        },
        set: function (value) {
            this._toolbarTemplate = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "chartTemplate", {
        get: function () {
            return this._chartTemplate;
        },
        set: function (value) {
            this._chartTemplate = value;
        },
        enumerable: true,
        configurable: true
    });
    IgrFinancialChart.prototype._checkToolbarSize = function () {
        if (this._toolbarElement) {
            var start = this._toolbarElement;
            if (start.children.length == 1) {
                start = start.children[0];
            }
            if (start.children.length == 1) {
                start = start.children[0];
            }
            var toolbarRoot = start.querySelector(".financialChartToolbar");
            var rootRect = toolbarRoot.getBoundingClientRect();
            var hideRemaining = false;
            for (var i = 0; i < toolbarRoot.children.length; i++) {
                var child = toolbarRoot.children[i];
                if (child.nodeType == Node.ELEMENT_NODE) {
                    if (!hideRemaining) {
                        child.style.display = "";
                    }
                    var childRect = child.getBoundingClientRect();
                    if (hideRemaining ||
                        childRect.left + childRect.width >
                            rootRect.left + rootRect.width) {
                        child.style.display = "none";
                        hideRemaining = true;
                    }
                    else {
                        child.style.display = "";
                    }
                }
            }
        }
    };
    IgrFinancialChart.prototype.componentWillUnmount = function () {
        this._chart.destroy();
        this._wrapper.destroy();
        if (document) {
            document.removeEventListener("click", this.onDocumentClick);
        }
    };
    IgrFinancialChart.prototype.onDocumentClick = function (ev) {
        this._chart.onDocumentClick(ev);
    };
    IgrFinancialChart.prototype.rewrapAxis = function (axis) {
        var axisName = axis.$type.name;
        var componentName = "Igr" + axisName;
        if (TypeRegistrar.isRegistered(componentName)) {
            var x = TypeRegistrar.create(componentName);
            x._implementation = axis;
            axis.externalObject = x;
        }
        else {
            throw new Error("Axis type not loaded: " + componentName);
        }
    };
    IgrFinancialChart.prototype.createImplementation = function () {
        return new FinancialChart();
    };
    Object.defineProperty(IgrFinancialChart.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgrFinancialChart.prototype.createSeriesComponent = function (type) {
        if (TypeRegistrar.isRegistered(type)) {
            var s = TypeRegistrar.create(type);
            s.owner = this;
            return s;
        }
        else {
            //we shouldn't get here, hopefully.
            throw Error("series type not loaded: " + type);
        }
    };
    IgrFinancialChart.prototype.createIndicator = function (typeName) {
        return this.createSeriesComponent("Igr" + typeName);
    };
    IgrFinancialChart.prototype.createOverlay = function (typeName) {
        return this.createSeriesComponent("Igr" + typeName);
    };
    IgrFinancialChart.prototype.createSeries = function (type) {
        switch (type) {
            case DataSeriesType.Area:
                return this.createSeriesComponent('IgrAreaSeries');
            case DataSeriesType.Column:
                return this.createSeriesComponent('IgrColumnSeries');
            case DataSeriesType.Line:
                return this.createSeriesComponent('IgrLineSeries');
            case DataSeriesType.FinancialPrice:
                return this.createSeriesComponent('IgrFinancialPriceSeries');
            case DataSeriesType.ItemToolTipLayer:
                return this.createSeriesComponent('IgrItemToolTipLayer');
            case DataSeriesType.CategoryToolTipLayer:
                return this.createSeriesComponent('IgrCategoryToolTipLayer');
            case DataSeriesType.CrosshairLayer:
                return this.createSeriesComponent('IgrCrosshairLayer');
            case DataSeriesType.FinalValueLayer:
                return this.createSeriesComponent('IgrFinalValueLayer');
            case DataSeriesType.CalloutLayer:
                return this.createSeriesComponent('IgrCalloutLayer');
            default:
                return this.createSeriesComponent('IgrColumnSeries');
        }
    };
    IgrFinancialChart.prototype.createXAxis = function (type) {
        switch (type) {
            case FinancialChartXAxisMode.Ordinal:
                if (TypeRegistrar.isRegistered("IgrOrdinalTimeXAxis")) {
                    return TypeRegistrar.create("IgrOrdinalTimeXAxis");
                }
                else if (TypeRegistrar.isRegistered("IgrTimeXAxis")) {
                    return TypeRegistrar.create("IgrTimeXAxis");
                }
                else {
                    throw new Error("not valid axes components loaded");
                }
            case FinancialChartXAxisMode.Time:
                if (TypeRegistrar.isRegistered("IgrTimeXAxis")) {
                    return TypeRegistrar.create("IgrTimeXAxis");
                }
                else if (TypeRegistrar.isRegistered("IgrOrdinalTimeXAxis")) {
                    return TypeRegistrar.create("IgrOrdinalTimeXAxis");
                }
                else {
                    throw new Error("not valid axes components loaded");
                }
        }
    };
    IgrFinancialChart.prototype.createYAxis = function (type) {
        switch (type) {
            case FinancialChartYAxisMode.Numeric:
                if (TypeRegistrar.isRegistered("IgrNumericYAxis")) {
                    return TypeRegistrar.create("IgrNumericYAxis");
                }
                else if (TypeRegistrar.isRegistered("IgrPercentChangeYAxis")) {
                    return TypeRegistrar.create("IgrPercentChangeYAxis");
                }
                else {
                    throw new Error("not valid axes components loaded");
                }
            case FinancialChartYAxisMode.PercentChange:
                if (TypeRegistrar.isRegistered("IgrPercentChangeYAxis")) {
                    return TypeRegistrar.create("IgrPercentChangeYAxis");
                }
                else if (TypeRegistrar.isRegistered("IgrNumericYAxis")) {
                    return TypeRegistrar.create("IgrNumericYAxis");
                }
                else {
                    throw new Error("not valid axes components loaded");
                }
        }
    };
    Object.defineProperty(IgrFinancialChart.prototype, "dataSource", {
        get: function () {
            return this._dataSource;
        },
        set: function (value) {
            this._dataSource = value;
            this.bindData();
        },
        enumerable: true,
        configurable: true
    });
    IgrFinancialChart.prototype.bindData = function () {
        if (this._chart != null && this._chart !== undefined) {
            this._chart.itemsSource = this._dataSource;
        }
    };
    IgrFinancialChart.prototype.componentDidMount = function () {
        _super.prototype.componentDidMount.call(this);
        if (this._mainElement) {
            if (this._width) {
                this._mainElement.style.width = this._width;
            }
            if (this._height) {
                this._mainElement.style.height = this._height;
            }
        }
        this.initializeContent();
        this._chart.notifyResized();
    };
    IgrFinancialChart.prototype.initializeContent = function () {
        var _this = this;
        if (TypeRegistrar.isRegistered("IgrDataChartDefaultTooltips")) {
            var d = TypeRegistrar.create("IgrDataChartDefaultTooltips");
            this._defaultTooltips = d;
            this._onDefaultTooltipsReady(d);
            //this._container.appendChild(cr.location.nativeElement);
        }
        var context = this._chart.getContext();
        if (!this._defaultTemplates) {
            this._defaultTemplates = new IgrFinancialChartDefaultTemplates();
        }
        var toolbarArea = this._toolbarTemplateComponent;
        var toolbarContext = context.vm.toolbar;
        toolbarContext.vm.financialChartIndicatorMenu.template = this.indicatorMenuTemplate ? this.indicatorMenuTemplate : this._defaultTemplates.financialChartIndicatorMenuTemplate;
        toolbarContext.vm.financialChartIndicatorMenu.vm.notifyChanged = function () { toolbarArea.dataContext = toolbarContext; };
        toolbarContext.vm.financialChartTypePicker.template = this.chartTypePickerTemplate ? this.chartTypePickerTemplate : this._defaultTemplates.financialChartTypePickerTemplate;
        toolbarContext.vm.financialChartTypePicker.vm.notifyChanged = function () { toolbarArea.dataContext = toolbarContext; };
        toolbarContext.vm.financialChartRangeSelector.template = this.rangeSelectorTemplate ? this.rangeSelectorTemplate : this._defaultTemplates.financialChartRangeSelectorTemplate;
        toolbarContext.vm.financialChartRangeSelector.vm.notifyChanged = function () {
            toolbarArea.dataContext = toolbarContext;
        };
        toolbarContext.template = this.toolbarTemplate ? this.toolbarTemplate : this._defaultTemplates.financialChartToolbarTemplate;
        var toolContainer = this._toolbarElement;
        //let toolbarArea = this._templates.toArray()[0];
        //let mainArea = this._templates.toArray()[1];
        toolbarArea.contentReady = function () {
            toolbarArea.contentReady = null;
            _this._chart.provideGrid(gridWrapper);
            _this._checkToolbarSize();
        };
        toolbarArea.dataContext = toolbarContext;
        toolbarArea.template = toolbarContext.template;
        var ele = this._toolbarElement;
        //ele.style.width = "100%";
        //ele.style.height = "100%";
        //if (ele.parentElement != null) {
        //    ele.parentElement.removeChild(ele);
        //}
        //toolContainer.appendChild(ele);
        //this._wrapper.setStyleProperty(ele, "display", "")
        ele.style.display = "";
        var legendContainer = context.legendContainer.rootWrapper.getNativeElement();
        var mainContainer = context.container.rootWrapper.getNativeElement();
        var indicatorContainer = context.indicatorsContainer.rootWrapper.getNativeElement();
        var volumeContainer = context.volumeContainer.rootWrapper.getNativeElement();
        var zoomSliderContainer = context.zoomContainer.rootWrapper.getNativeElement();
        var main = this._mainGridElement;
        var templateMain = main.querySelector(".financialChartPrice");
        var templateToolbar = main.querySelector(".financialChartToolbar");
        var templateLegend = main.querySelector(".financialChartLegend");
        var templateIndicator = main.querySelector(".financialChartIndicators");
        var templateVolume = main.querySelector(".financialChartVolume");
        var templateZoomSlider = main.querySelector(".financialChartZoomSlider");
        var grid = main; // main.querySelector(".financialChartMainGrid");
        var gridWrapper = new ReactWrapper(grid, this._wrapper);
        templateMain.appendChild(mainContainer);
        //templateToolbar.appendChild(toolContainer);
        templateLegend.appendChild(legendContainer);
        templateIndicator.appendChild(indicatorContainer);
        templateVolume.appendChild(volumeContainer);
        templateZoomSlider.appendChild(zoomSliderContainer);
        this._styling(this._container, this);
        //this._mainElement.nativeElement.parentElement.removeChild(this._mainElement.nativeElement);
        //this.container.appendChild(this._mainElement.nativeElement);
    };
    IgrFinancialChart.prototype._createZoomSlider = function (hostEle, onReady) {
        if (!TypeRegistrar.isRegistered("IgrZoomSlider")) {
            //shouldn't happen.
            throw new Error("zoom slider component isn't loaded");
        }
        var Slider = TypeRegistrar.get("IgrZoomSlider");
        var ele = React.createElement(Slider, {
            width: '100%', height: '100%', ref: function (r) {
                onReady(r);
            }
        });
        var portal = ReactDOM.createPortal(ele, hostEle);
        hostEle.className = "test";
        hostEle.style.width = "100%";
        hostEle.style.height = "100%";
        this._sliderPortal = portal;
    };
    IgrFinancialChart.prototype.createTooltip = function () {
        // if (!TypeRegistrar.isRegistered("IgrTooltipContainer")) {
        // 	return null;
        // }
        // let Tooltip = TypeRegistrar.get("IgrTooltipContainer");
        var wrapper = this._wrapper.createElement("div");
        var ele = wrapper.getNativeElement();
        ele.key = "__tooltip_" + this._uniqueTooltipId;
        this._uniqueTooltipId++;
        this._currentTooltips = this._currentTooltips.slice(0);
        this._currentTooltips.push(ele);
        //let element = React.createElement(Tooltip,  );
        //let portal = ReactDOM.createPortal(element, ele);
        var self = this;
        ele.updateToolTip = function (c, isSubContent) {
            if (c.externalObject) {
                c = c.externalObject;
            }
            else {
                var ext = new IgrDataContext();
                ext._implementation = c;
                c = ext;
            }
            if (!isSubContent) {
                if (ele.parentElement != self._container) {
                    if (ele.parentElement != null) {
                        ele.parentElement.removeChild(ele);
                    }
                    self._container.appendChild(ele);
                }
            }
            else {
                c.isSubContent = true;
            }
            if (self._activeTooltips.has(ele)) {
                var t = self._activeTooltips.get(ele);
                t.dataContext = c;
            }
            ele.style.display = "block";
            return true;
        };
        ele.hideToolTip = function () {
            ele.style.display = "none";
        };
        ele.style.display = "none";
        this._updateTooltipState();
        return ele;
    };
    IgrFinancialChart.prototype._ensureTooltipCreated = function (series) {
        var _this = this;
        series._ensureTooltipCreated(function () { return _this.createTooltip(); }, function (ele) {
            var wrapper = new ReactWrapper(ele, _this._wrapper);
            wrapper.updateToolTip = ele.updateToolTip;
            wrapper.hideToolTip = ele.hideToolTip;
            if (_this._activeTooltips.has(ele)) {
                var tCont = _this._activeTooltips.get(ele);
                tCont.template = ele.tooltipTemplate;
            }
            return wrapper;
        });
    };
    // private _createXAxis(): any {
    //     let x = new IgxCategoryXAxisComponent();
    //     return x.i;
    // }
    // private _createYAxis(): any {
    //     let y = new IgxNumericYAxisComponent();
    //     return y.i;
    // }
    IgrFinancialChart.prototype._ensureDefaultTooltip = function (series) {
        if (this._defaultTooltips == null) {
            return;
        }
        this._defaultTooltips["ensureDefaultTooltip"](series);
    };
    IgrFinancialChart.prototype._onDefaultTooltipsReady = function (cr) {
        if (this.i.dataChart) {
            var currSeries = this.i.dataChart.series;
            for (var i = 0; i < currSeries.count; i++) {
                if (currSeries.item(i).externalObject.showDefaultTooltip) {
                    this._ensureDefaultTooltip(currSeries.item(i).externalObject);
                }
            }
        }
    };
    IgrFinancialChart.prototype._updateTooltipState = function () {
        if (this._initialized) {
            this.setState({ tooltips: this._currentTooltips });
        }
    };
    Object.defineProperty(IgrFinancialChart.prototype, "xAxisBreaks", {
        /**
         * TimeAxisBreaks to apply to this chart when in time axis mode, representing spans of time to omit, such as weekends.
        */
        get: function () {
            if (this._xAxisBreaks === null) {
                if (!TypeRegistrar.isRegistered("IgrTimeAxisBreakCollection")) {
                    return null;
                }
                var coll = TypeRegistrar.create("IgrTimeAxisBreakCollection");
                var innerColl = this.i.xAxisBreaks;
                if (!innerColl) {
                    innerColl = TypeRegistrar.create("TimeAxisBreakCollection");
                }
                this._xAxisBreaks = coll._fromInner(innerColl);
                this.i._xAxisBreaks = innerColl;
            }
            return this._xAxisBreaks;
        },
        set: function (v) {
            if (this._xAxisBreaks !== null) {
                this._xAxisBreaks._setSyncTarget(null);
                this._xAxisBreaks = null;
            }
            if (!TypeRegistrar.isRegistered("IgxTimeAxisBreakCollection")) {
                return;
            }
            var coll = TypeRegistrar.create("IgxTimeAxisBreakCollection");
            var t = TypeRegistrar.get("TimeAxisBreak");
            this._xAxisBreaks = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(t.$type);
            var innerColl = this.i.xAxisBreaks;
            if (!innerColl) {
                innerColl = TypeRegistrar.create("TimeAxisBreakCollection");
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._xAxisBreaks._setSyncTarget(syncColl);
            this.i._xAxisBreaks = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "leftMargin", {
        get: function () {
            return this.i.dh;
        },
        set: function (v) {
            this.i.dh = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "isHorizontalZoomEnabled", {
        get: function () {
            return this.i.b5;
        },
        set: function (v) {
            this.i.b5 = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "toolbarHeight", {
        get: function () {
            return this.i.t5;
        },
        set: function (v) {
            this.i.t5 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisIsLogarithmic", {
        /**
         * Gets or sets whether the Y-axis should use a logarithmic scale instead of a linear one.
         * Since log(-1) is imaginary and log(0) is undefined, it is recommended to enable this property only when the Y-axis minimum is greater than zero.
        */
        get: function () {
            return this.i.tb;
        },
        set: function (v) {
            this.i.tb = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisLogarithmBase", {
        /**
         * Gets or sets the base value to use in the log function when mapping the position of data items along the Y-axis.
         * This property is effective only when YAxisIsLogarithmic is true.
        */
        get: function () {
            return this.i.ux;
        },
        set: function (v) {
            this.i.ux = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisInterval", {
        /**
         * Gets or sets the distance between each label and grid line along the Y-axis.
        *
        * The `yAxisInterval` determines how often to show a label, tickmark, and/or gridline along the y-axis.  Set this property to a number less than the numeric range of the y-axis.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	yAxisInterval={20}
        *  />
        * ```
        */
        get: function () {
            return this.i.t9;
        },
        set: function (v) {
            this.i.t9 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisMinimumValue", {
        /**
         * Gets or sets the data value corresponding to the minimum value of the Y-axis.
        *
        * The `yAxisMinimumValue` determines starting value of labels, tickmarks, and gridlines on the y-axis.
        *
        * ```ts
        * <IgrFinancialChart
        *     yAxisMinimumValue={-200}
        *     yAxisMaximumValue={1000}
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.ub;
        },
        set: function (v) {
            this.i.ub = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisMaximumValue", {
        /**
         * Gets or sets the data value corresponding to the maximum value of the Y-axis.
        *
        * The `yAxisMaximumValue` determines ending value of labels, tickmarks, and gridlines on the y-axis.
        *
        * ```ts
        * <IgrFinancialChart
        *  yAxisMinimumValue={-200}
        *     yAxisMaximumValue={100}
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.ua;
        },
        set: function (v) {
            this.i.ua = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisMinorInterval", {
        /**
         * Gets or sets the frequency of displayed minor lines along the Y-axis.
        *
        * The `yAxisMinorInterval` determines how often to show minor gridline along the y-axis.  Set this property to a number less than the `yAxisInterval` and the numeric range of the y-axis.
        *
        * ```ts
        * <IgrFinancialChart
        *      yAxisMinorInterval={50}
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.uc;
        },
        set: function (v) {
            this.i.uc = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisActualMinimum", {
        /**
         * Gets the current minimum value for the Y-axis.
        */
        get: function () {
            return this.i.t8;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisActualMaximum", {
        /**
         * Gets the current maximum value for the Y-axis.
        */
        get: function () {
            return this.i.t7;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "volumeType", {
        /**
         * The type of series to display in the volume pane.
        *
        * Use the `volumeType` property to set a type of all series that will be rendered in the volume pane, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	volumeType="Column" />
        * ```
        */
        get: function () {
            return this.i.rf;
        },
        set: function (v) {
            this.i.rf = ensureEnum(FinancialChartVolumeType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "xAxisMode", {
        /**
         * The scaling mode of the X-axis.
        *
        * Use the `xAxisMode` property to plot data items without any breaks in data range (Ordinal mode) or with breaks in data range (Time mode) such as weekends/holidays. Note that the Ordinal axis mode is less expensive to use in the financial chart than the Time axis mode.
        *
        * ```ts
        * <IgrFinancialChart
        *      xAxisMode="time"
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.rh;
        },
        set: function (v) {
            this.i.rh = ensureEnum(FinancialChartXAxisMode_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisMode", {
        /**
         * The scaling mode of the Y-axis.
        *
        * Use the `yAxisMode` property to plot data items using their actual values (Numeric) or using percent changes from the first data point (PercentChange), e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *      yAxisMode={this.state.yAxisMode}
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.rj;
        },
        set: function (v) {
            this.i.rj = ensureEnum(FinancialChartYAxisMode_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "isToolbarVisible", {
        /**
         * A boolean property controlling the visibility of the toolbar.
        */
        get: function () {
            return this.i.s6;
        },
        set: function (v) {
            this.i.s6 = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "chartType", {
        /**
         * The type of price series to display in the main chart.
        *
        * Use the `chartType` property to set a type of series that will be used to render prices in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *   width="100%"
        *   height="400px"
        * 	chartType="Candle"
        *   dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.ra;
        },
        set: function (v) {
            this.i.ra = ensureEnum(FinancialChartType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisLabelHorizontalAlignment", {
        /**
         * Gets or sets Horizontal alignment of Y-axis labels.
        */
        get: function () {
            return this.i.o6;
        },
        set: function (v) {
            this.i.o6 = ensureEnum(HorizontalAlignment_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "isWindowSyncedToVisibleRange", {
        /**
         * A boolean indicating whether the chart should automatically zoom in vertically on the currently visible range of data.
         * When this property is set to true, panning and zooming along the X-axis will result in a corresponding zoom on the Y-axis, so that the visible range of data fills the zoom window as fully as possible.
        */
        get: function () {
            return this.i.s7;
        },
        set: function (v) {
            this.i.s7 = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorTypes", {
        /**
         * A collection indicating what financial indicator types to display on the Financial Chart.
        *
        * Use the `indicatorTypes` property to set types of indicators that will be rendered below the price pane in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorTypes="ForceIndex" />
        * ```
        */
        get: function () {
            if (this._indicatorTypes === null) {
                var coll = new IgrFinancialIndicatorTypeCollection();
                var innerColl = this.i.ro;
                if (!innerColl) {
                    innerColl = new FinancialIndicatorTypeCollection_internal(0);
                }
                this._indicatorTypes = coll._fromInner(innerColl);
                this.i.ro = innerColl;
            }
            return this._indicatorTypes;
        },
        set: function (v) {
            if (this._indicatorTypes !== null) {
                this._indicatorTypes._setSyncTarget(null);
                this._indicatorTypes = null;
            }
            var coll = new IgrFinancialIndicatorTypeCollection();
            this._indicatorTypes = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(FinancialIndicatorType_$type);
            var innerColl = this.i.ro;
            if (!innerColl) {
                innerColl = new FinancialIndicatorTypeCollection_internal(0);
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._indicatorTypes._setSyncTarget(syncColl);
            this.i.ro = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "overlayTypes", {
        /**
         * A collection indicating what financial overlay types to display on the Financial Chart.
        *
        * Use the `overlayTypes` property to set types of overlays that will be rendered behind price series in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	overlayType ="PriceChannel" />
        * ```
        */
        get: function () {
            if (this._overlayTypes === null) {
                var coll = new IgrFinancialOverlayTypeCollection();
                var innerColl = this.i.rq;
                if (!innerColl) {
                    innerColl = new FinancialOverlayTypeCollection_internal(0);
                }
                this._overlayTypes = coll._fromInner(innerColl);
                this.i.rq = innerColl;
            }
            return this._overlayTypes;
        },
        set: function (v) {
            if (this._overlayTypes !== null) {
                this._overlayTypes._setSyncTarget(null);
                this._overlayTypes = null;
            }
            var coll = new IgrFinancialOverlayTypeCollection();
            this._overlayTypes = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(FinancialOverlayType_$type);
            var innerColl = this.i.rq;
            if (!innerColl) {
                innerColl = new FinancialOverlayTypeCollection_internal(0);
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._overlayTypes._setSyncTarget(syncColl);
            this.i.rq = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisAbbreviateLargeNumbers", {
        /**
         * Gets or sets whether the large numbers on the Y-axis labels are abbreviated.
        */
        get: function () {
            return this.i.ta;
        },
        set: function (v) {
            this.i.ta = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "resolution", {
        /**
         * Gets or sets the rendering resolution for all series in this chart.
         * Where n = Resolution, for every n horizontal pixels, combine all items into a single datapoint.  When Resolution = 0, all datapoints will be rendered as graphical objects.  Charts with a higher resolution will have faster performance.
        */
        get: function () {
            return this.i.dp;
        },
        set: function (v) {
            this.i.dp = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "yAxisLabelLocation", {
        /**
         * Gets or sets the location of Y-axis labels, relative to the plot area.
        */
        get: function () {
            return this.i.jw;
        },
        set: function (v) {
            this.i.jw = ensureEnum(AxisLabelsLocation_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "zoomSliderType", {
        /**
         * Gets or sets type of series to display in the zoom slider pane.
        *
        * Use the `zoomSliderType` property to set a type of all series that will be rendered in the zoom pane, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     zoomSliderType="Candle"
        *     dataSource={this.data} />
        * ```
        */
        get: function () {
            return this.i.rm;
        },
        set: function (v) {
            this.i.rm = ensureEnum(FinancialChartZoomSliderType_$type, v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "negativeBrushes", {
        /**
         * Gets or sets the palette used for coloring negative items of Waterfall chart type.
        *
        * Use the `negativeBrushes` property to set a collection of brushes that will be used to render fill area of negative elements in the price pane, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	negativeBrushes="Red" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qj);
        },
        set: function (v) {
            this.i.qj = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "negativeOutlines", {
        /**
         * Brushes to use for drawing negative elements, when using a chart type with contextual coloring, such as Waterfall.
        *
        * Use the `negativeOutlines` property to set a collection of brushes that will be used to render outline of negative elements in the price pane, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	negativeOutlines= "Green"/>
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qk);
        },
        set: function (v) {
            this.i.qk = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "overlayBrushes", {
        /**
         * Brushes to use for filling financial overlays.
        *
        * Use the `overlayBrushes` property to set a collection of brushes that will be used to render fill area of overlays in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	overlayBrushes="Green" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.ql);
        },
        set: function (v) {
            this.i.ql = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "overlayOutlines", {
        /**
         * Brushes to use for outlining financial overlays.
        *
        * Use the `overlayOutlines` property to set a collection of brushes that will be used to render outlines of overlays in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	overlayOutlines="Red" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qm);
        },
        set: function (v) {
            this.i.qm = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "volumeOutlines", {
        /**
         * Brushes to use for outlining volume series in the volume pane.
        *
        * Use the `volumeOutlines` property to set a collection of brushes that will be used to render outline of multiple series in the volume pane of the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	volumeOutlines="Green" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qo);
        },
        set: function (v) {
            this.i.qo = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "volumeBrushes", {
        /**
         * Brushes to use for filling volume series in the volume pane.
        *
        * Use the `volumeBrushes` property to set a collection of brushes that will be used to render fill area of multiple series in the volume pane of the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	volumeBrushes="Green" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qn);
        },
        set: function (v) {
            this.i.qn = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorNegativeBrushes", {
        /**
         * Brushes to use for negative elements in financial indicators.
        *
        * Use the `indicatorNegativeBrushes` property to set a collection of brushes that will be used to render negative elements of indicators in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorNegativeBrushes="Red"/>
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qi);
        },
        set: function (v) {
            this.i.qi = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorBrushes", {
        /**
         * Brushes to use for financial indicators.
        *
        * Use the `indicatorBrushes` property to set a collection of brushes that will be used to render positive elements of indicators in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorBrushes="Green" />
        * ```
        */
        get: function () {
            return fromBrushCollection(this.i.qh);
        },
        set: function (v) {
            this.i.qh = toBrushCollection(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "volumeThickness", {
        /**
         * The outline thickness of volume series in the volume pane.
        *
        * Use the `volumeThickness` property to set a number that will be used to render outline thickness of all series in the volume pane, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	volumeThickness= {2.5}/>
        * ```
        */
        get: function () {
            return this.i.t6;
        },
        set: function (v) {
            this.i.t6 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "overlayThickness", {
        /**
         * The outline thickness of financial overlays.
        *
        * Use the `overlayThickness` property to set a number that will be used to render outline thickness of all overlays in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	overlayThickness ={2.5}  />
        * ```
        */
        get: function () {
            return this.i.t4;
        },
        set: function (v) {
            this.i.t4 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorThickness", {
        /**
         * The outline or stroke thickness of financial indicators.
        *
        * Use the `indicatorThickness` property to set a number that will be used to render outline thickness of all indicators in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorThickness={2.5}  />
        * ```
        */
        get: function () {
            return this.i.t3;
        },
        set: function (v) {
            this.i.t3 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorDisplayTypes", {
        /**
         * The display types of financial indicators.
        *
        * Use the `indicatorDisplayTypes` property to set display types that will determine whether render all indicators as area, lines, or columns in the Financial Chart control, e.g.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorDisplayTypes="line" />
        * ```
        */
        get: function () {
            if (this._indicatorDisplayTypes === null) {
                var coll = new IgrIndicatorDisplayTypeCollection();
                var innerColl = this.i.r0;
                if (!innerColl) {
                    innerColl = new IndicatorDisplayTypeCollection_internal();
                }
                this._indicatorDisplayTypes = coll._fromInner(innerColl);
                this.i.r0 = innerColl;
            }
            return this._indicatorDisplayTypes;
        },
        set: function (v) {
            if (this._indicatorDisplayTypes !== null) {
                this._indicatorDisplayTypes._setSyncTarget(null);
                this._indicatorDisplayTypes = null;
            }
            var coll = new IgrIndicatorDisplayTypeCollection();
            this._indicatorDisplayTypes = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(IndicatorDisplayType_$type);
            var innerColl = this.i.r0;
            if (!innerColl) {
                innerColl = new IndicatorDisplayTypeCollection_internal();
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._indicatorDisplayTypes._setSyncTarget(syncColl);
            this.i.r0 = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorPeriod", {
        /**
         * The period of financial indicators, where applicable.
        *
        * The `indicatorPeriod` property applies to only the `BollingerBands` overlay as well as to these indicators types: `AverageDirectionalIndex`, `AverageTrueRange`, `BollingerBandWidth`, `ChaikinVolatility`, `CommodityChannelIndex`, `DetrendedPriceOscillator`, `FastStochasticOscillator`, `ForceIndex`, `FullStochasticOscillator`, `MoneyFlowIndex`, `IgrPriceChannelOverlay`, `RateOfChangeAndMomentum`, `RelativeStrengthIndex`, `SlowStochasticOscillator`, `StandardDeviation`, `StochRSI`, `TRIX`, `WilliamsPercentR`
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorPeriod={8} />
        * ```
        */
        get: function () {
            return this.i.us;
        },
        set: function (v) {
            this.i.us = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorMultiplier", {
        /**
         * The multiplier of financial indicators, where applicable.
        *
        * The `indicatorMultiplier` property applies to only to BollingerBandWidth indicator type.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorMultiplier= {8} />
        * ```
        */
        get: function () {
            return this.i.t2;
        },
        set: function (v) {
            this.i.t2 = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorSmoothingPeriod", {
        /**
         * The smoothing period of financial indicators, where applicable.
        *
        * The `indicatorSmoothingPeriod` property applies to only to `FullStochasticOscillator` indicator type.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorSmoothingPeriod={8}     />
        * ```
        */
        get: function () {
            return this.i.uv;
        },
        set: function (v) {
            this.i.uv = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorShortPeriod", {
        /**
         * The short period of financial indicators, where applicable.
        *
        * The `indicatorShortPeriod` property applies only to these indicator types:
        *
        * -   AbsoluteVolumeOscillator,
        * -   ChaikinOscillator,
        * -   MovingAverageConvergenceDivergence,
        * -   PercentagePriceOscillator,
        * -   PercentageVolumeOscillator,
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorShortPeriod={8} />
        * ```
        */
        get: function () {
            return this.i.ut;
        },
        set: function (v) {
            this.i.ut = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorLongPeriod", {
        /**
         * The long period of financial indicators, where applicable.
        *
        * The `indicatorLongPeriod` property applies only to these indicator types:
        *
        * -   AbsoluteVolumeOscillator,
        * -   ChaikinOscillator,
        * -   MovingAverageConvergenceDivergence,
        * -   PercentagePriceOscillator,
        * -   PercentageVolumeOscillator,
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorLongPeriod={8} />
        * ```
        */
        get: function () {
            return this.i.ur;
        },
        set: function (v) {
            this.i.ur = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "indicatorSignalPeriod", {
        /**
         * The signal period of financial indicators, where applicable.
        *
        * The `indicatorSignalPeriod` property applies to only to MovingAverageConvergenceDivergence indicator type.
        *
        * ```ts
        * <IgrFinancialChart
        *     width="100%"
        *     height="400px"
        *     dataSource={this.data}
        * 	indicatorSignalPeriod ={8} />
        * ```
        */
        get: function () {
            return this.i.uu;
        },
        set: function (v) {
            this.i.uu = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "rangeSelectorOptions", {
        /**
         * A FinancialChartRangeSelectorOptionCollection containing the available range selector options on the toolbar.
        */
        get: function () {
            if (this._rangeSelectorOptions === null) {
                var coll = new IgrFinancialChartRangeSelectorOptionCollection();
                var innerColl = this.i.q6;
                if (!innerColl) {
                    innerColl = new FinancialChartRangeSelectorOptionCollection_internal(0);
                }
                this._rangeSelectorOptions = coll._fromInner(innerColl);
                this.i.q6 = innerColl;
            }
            return this._rangeSelectorOptions;
        },
        set: function (v) {
            if (this._rangeSelectorOptions !== null) {
                this._rangeSelectorOptions._setSyncTarget(null);
                this._rangeSelectorOptions = null;
            }
            var coll = new IgrFinancialChartRangeSelectorOptionCollection();
            this._rangeSelectorOptions = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(FinancialChartRangeSelectorOption_$type);
            var innerColl = this.i.q6;
            if (!innerColl) {
                innerColl = new FinancialChartRangeSelectorOptionCollection_internal(0);
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._rangeSelectorOptions._setSyncTarget(syncColl);
            this.i.q6 = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "customIndicatorNames", {
        /**
         * The names of custom indicators to add to the chart.
         * When CustomIndicatorNames is set, the ApplyCustomIndicators event will be raised for each custom indicator name.
        */
        get: function () {
            if (this._customIndicatorNames === null) {
                var coll = new IgrCustomIndicatorNameCollection();
                var innerColl = this.i.customIndicatorNames;
                if (!innerColl) {
                    innerColl = new CustomIndicatorNameCollection_internal(0);
                }
                this._customIndicatorNames = coll._fromInner(innerColl);
                this.i.customIndicatorNames = innerColl;
            }
            return this._customIndicatorNames;
        },
        set: function (v) {
            if (this._customIndicatorNames !== null) {
                this._customIndicatorNames._setSyncTarget(null);
                this._customIndicatorNames = null;
            }
            var coll = new IgrCustomIndicatorNameCollection();
            this._customIndicatorNames = coll._fromOuter(v);
            var syncColl = new SyncableObservableCollection$1(String_$type);
            var innerColl = this.i.customIndicatorNames;
            if (!innerColl) {
                innerColl = new CustomIndicatorNameCollection_internal(0);
            }
            syncColl._inner = innerColl;
            syncColl.clear();
            this._customIndicatorNames._setSyncTarget(syncColl);
            this.i.customIndicatorNames = innerColl;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "isVerticalZoomEnabled", {
        get: function () {
            return this.i.cb;
        },
        set: function (v) {
            this.i.cb = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "zoomSliderXAxisMajorStroke", {
        /**
         * Gets or sets stroke brush of major gridlines on x-axis of the zoom slider pane
        */
        get: function () {
            return brushToString(this.i.yy);
        },
        set: function (v) {
            this.i.yy = stringToBrush(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "zoomSliderXAxisMajorStrokeThickness", {
        /**
         * Gets or sets thickness of major gridlines on x-axis of the zoom slider pane
        */
        get: function () {
            return this.i.ud;
        },
        set: function (v) {
            this.i.ud = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "isLegendVisible", {
        /**
         * Gets or sets weather or not a legend is visible between toolbar and chart's plot area
        */
        get: function () {
            return this.i.s2;
        },
        set: function (v) {
            this.i.s2 = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "xAxisMinimumValue", {
        /**
         * Gets or sets minimum value on x-axis
        */
        get: function () {
            return this.i.tq;
        },
        set: function (v) {
            this.i.tq = v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgrFinancialChart.prototype, "xAxisMaximumValue", {
        /**
         * Gets or sets maximum value on x-axis
        */
        get: function () {
            return this.i.tp;
        },
        set: function (v) {
            this.i.tp = v;
        },
        enumerable: true,
        configurable: true
    });
    IgrFinancialChart.prototype.findByName = function (name) {
        var baseResult = _super.prototype.findByName.call(this, name);
        if (baseResult) {
            return baseResult;
        }
        if (this.indicatorTypes != null && this.indicatorTypes.findByName && this.indicatorTypes.findByName(name)) {
            return this.indicatorTypes.findByName(name);
        }
        if (this.overlayTypes != null && this.overlayTypes.findByName && this.overlayTypes.findByName(name)) {
            return this.overlayTypes.findByName(name);
        }
        if (this.indicatorDisplayTypes != null && this.indicatorDisplayTypes.findByName && this.indicatorDisplayTypes.findByName(name)) {
            return this.indicatorDisplayTypes.findByName(name);
        }
        if (this.rangeSelectorOptions != null && this.rangeSelectorOptions.findByName && this.rangeSelectorOptions.findByName(name)) {
            return this.rangeSelectorOptions.findByName(name);
        }
        if (this.xAxisBreaks != null && this.xAxisBreaks.findByName && this.xAxisBreaks.findByName(name)) {
            return this.xAxisBreaks.findByName(name);
        }
        return null;
    };
    /**
 * Called by the UI framework to provide a UI container for rendering this control.

* @param container  * The UI container element.
*/
    IgrFinancialChart.prototype.provideContainer = function (container) {
        this.i.provideContainer(container);
    };
    IgrFinancialChart.prototype.notifyInsertItem = function (source_, index, newItem) {
        this.i.h0(source_, index, newItem);
    };
    IgrFinancialChart.prototype.notifyRemoveItem = function (source_, index, oldItem) {
        this.i.h1(source_, index, oldItem);
    };
    IgrFinancialChart.prototype.notifyClearItems = function (source_) {
        this.i.hz(source_);
    };
    IgrFinancialChart.prototype.notifySetItem = function (source_, index, oldItem, newItem) {
        this.i.h3(source_, index, oldItem, newItem);
    };
    /**
     * Returns visuals as a serialized string.
    
    */
    IgrFinancialChart.prototype.exportSerializedVisualData = function () {
        var iv = this.i.vh();
        return (iv);
    };
    Object.defineProperty(IgrFinancialChart.prototype, "applyCustomIndicators", {
        /**
         * Event raised by the chart when custom indicator data is needed from the application.
         * During series rendering, event will be raised once for each value in the CustomIndicatorNames collection.
        */
        get: function () {
            return this._applyCustomIndicators;
        },
        set: function (ev) {
            var _this = this;
            if (this._applyCustomIndicators_wrapped !== null) {
                this.i.applyCustomIndicators = delegateRemove(this.i.applyCustomIndicators, this._applyCustomIndicators_wrapped);
                this._applyCustomIndicators_wrapped = null;
                this._applyCustomIndicators = null;
            }
            this._applyCustomIndicators = ev;
            this._applyCustomIndicators_wrapped = function (o, e) {
                var outerArgs = new IgrFinancialChartCustomIndicatorArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeApplyCustomIndicators) {
                    _this.beforeApplyCustomIndicators(_this, outerArgs);
                }
                if (_this._applyCustomIndicators) {
                    _this._applyCustomIndicators(_this, outerArgs);
                }
            };
            this.i.applyCustomIndicators = delegateCombine(this.i.applyCustomIndicators, this._applyCustomIndicators_wrapped);
        },
        enumerable: true,
        configurable: true
    });
    return IgrFinancialChart;
}(IgrXYChart));
export { IgrFinancialChart };
//# sourceMappingURL=igr-financial-chart.js.map
