import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
import { HorizontalAlignment_$type } from "igniteui-react-core/ES2015/HorizontalAlignment";
import { UnknownValuePlotting_$type } from "igniteui-react-core/ES2015/UnknownValuePlotting";
import { MarkerTypeCollection } from "./igr-marker-type-collection";
import { TrendLineType_$type } from "igniteui-react-core/ES2015/TrendLineType";
import { ChartSeriesEventArgs } from "./igr-chart-series-event-args";
import { DomainChartSeriesPointerEventArgs } from "./igr-domain-chart-series-pointer-event-args";
import { getModifiedProps, isValidProp, brushToString, stringToBrush, toBrushCollection, fromBrushCollection, ensureBool, fromRect, toRect, ensureEnum } from "igniteui-react-core/ES2015/componentUtil";
import { MarkerTypeCollection as MarkerTypeCollection_internal } from "./MarkerTypeCollection";
/**
 * Represents a base class for all domain charts that can plot scatter data and shapefiles
*/
export class IgrDomainChart extends React.Component {
    constructor(props) {
        super(props);
        this._markerTypes = null;
        this._seriesAdded = null;
        this._seriesAdded_wrapped = null;
        this._seriesRemoved = null;
        this._seriesRemoved_wrapped = null;
        this._seriesPointerEnter = null;
        this._seriesPointerEnter_wrapped = null;
        this._seriesPointerLeave = null;
        this._seriesPointerLeave_wrapped = null;
        this._seriesPointerMove = null;
        this._seriesPointerMove_wrapped = null;
        this._seriesPointerDown = null;
        this._seriesPointerDown_wrapped = null;
        this._seriesPointerUp = null;
        this._seriesPointerUp_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return null;
    }
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    componentDidMount() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                this[p] = this.props[p];
            }
        }
    }
    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;
    }
    render() {
        return null;
    }
    /**
     * 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.bx;
    }
    set pixelScalingRatio(v) {
        this.i.bx = +v;
    }
    /**
     * Gets or sets the left margin of chart title
    */
    get titleLeftMargin() {
        return this.i.b6;
    }
    set titleLeftMargin(v) {
        this.i.b6 = +v;
    }
    /**
     * Gets or sets the right margin of chart title
    */
    get titleRightMargin() {
        return this.i.b7;
    }
    set titleRightMargin(v) {
        this.i.b7 = +v;
    }
    /**
     * Gets or sets the top margin of chart title
    */
    get titleTopMargin() {
        return this.i.b8;
    }
    set titleTopMargin(v) {
        this.i.b8 = +v;
    }
    /**
     * Gets or sets the bottom margin of chart title
    */
    get titleBottomMargin() {
        return this.i.b5;
    }
    set titleBottomMargin(v) {
        this.i.b5 = +v;
    }
    /**
     * Gets or sets the left margin of chart subtitle
    */
    get subtitleLeftMargin() {
        return this.i.b1;
    }
    set subtitleLeftMargin(v) {
        this.i.b1 = +v;
    }
    /**
     * Gets or sets the top margin of chart subtitle
    */
    get subtitleTopMargin() {
        return this.i.b3;
    }
    set subtitleTopMargin(v) {
        this.i.b3 = +v;
    }
    /**
     * Gets or sets the right margin of chart subtitle
    */
    get subtitleRightMargin() {
        return this.i.b2;
    }
    set subtitleRightMargin(v) {
        this.i.b2 = +v;
    }
    /**
     * Gets or sets the bottom margin of chart subtitle
    */
    get subtitleBottomMargin() {
        return this.i.b0;
    }
    set subtitleBottomMargin(v) {
        this.i.b0 = +v;
    }
    /**
     * Gets or sets color of chart subtitle
    */
    get subtitleTextColor() {
        return brushToString(this.i.ge);
    }
    set subtitleTextColor(v) {
        this.i.ge = stringToBrush(v);
    }
    /**
     * Gets or sets color of chart title
    */
    get titleTextColor() {
        return brushToString(this.i.gf);
    }
    set titleTextColor(v) {
        this.i.gf = stringToBrush(v);
    }
    /**
     * Gets or sets the left margin of the chart content.
    */
    get leftMargin() {
        return this.i.bw;
    }
    set leftMargin(v) {
        this.i.bw = +v;
    }
    /**
     * Gets or sets the top margin of the chart content.
    */
    get topMargin() {
        return this.i.b9;
    }
    set topMargin(v) {
        this.i.b9 = +v;
    }
    /**
     * Gets or sets the right margin of the chart content.
    */
    get rightMargin() {
        return this.i.bz;
    }
    set rightMargin(v) {
        this.i.bz = +v;
    }
    /**
     * Gets or sets the bottom margin around the chart content.
    */
    get bottomMargin() {
        return this.i.bv;
    }
    set bottomMargin(v) {
        this.i.bv = +v;
    }
    /**
     * Gets or sets the duration used for animating series plots when the data is changing
    */
    get transitionDuration() {
        return this.i.ci;
    }
    set transitionDuration(v) {
        this.i.ci = +v;
    }
    /**
     * Gets or sets the easing function used for animating series plots when the data is changing.
     * This can be set to one of the known values "linear" or "cubic," or it can be set to an easing function which takes a single numeric parameter and returns a number.
    */
    get transitionEasingFunction() {
        return this.i.ao;
    }
    set transitionEasingFunction(v) {
        this.i.ao = v;
    }
    /**
     * Gets or sets CSS font property for the chart subtitle
    */
    get subtitleTextStyle() {
        return this.i.dt;
    }
    set subtitleTextStyle(v) {
        this.i.dt = v;
    }
    /**
     * Gets or sets CSS font property for the chart title
    */
    get titleTextStyle() {
        return this.i.d4;
    }
    set titleTextStyle(v) {
        this.i.d4 = v;
    }
    /**
     * Gets or sets a set of property paths that should be included for consideration by the category chart, leaving the remainder excluded. If null, all properties will be considered.
    */
    get includedProperties() {
        return this.i.d;
    }
    set includedProperties(v) {
        this.i.d = v;
    }
    /**
     * Gets or sets a set of property paths that should be excluded from consideration by the category chart.
    */
    get excludedProperties() {
        return this.i.c;
    }
    set excludedProperties(v) {
        this.i.c = v;
    }
    /**
     * Gets or sets the palette of brushes to use for coloring the chart series.
     * The value provided should be an array of CSS color strings or JavaScript objects defining gradients. Optionally the first element can be a string reading "RGB" or "HSV" to specify the interpolation mode of the collection
    */
    get brushes() {
        return fromBrushCollection(this.i.j);
    }
    set brushes(v) {
        this.i.j = toBrushCollection(v);
    }
    /**
     * Gets or sets the palette of brushes to use for outlines on the chart series.
     * The value provided should be an array of CSS color strings or JavaScript objects defining gradients. Optionally the first element can be a string reading "RGB" or "HSV" to specify the interpolation mode of the collection
    */
    get outlines() {
        return fromBrushCollection(this.i.n);
    }
    set outlines(v) {
        this.i.n = toBrushCollection(v);
    }
    /**
     * Gets or sets whether the chart can be horizontally zoomed through user interactions.
    */
    get isHorizontalZoomEnabled() {
        return this.i.ay;
    }
    set isHorizontalZoomEnabled(v) {
        this.i.ay = ensureBool(v);
    }
    /**
     * Gets or sets whether the chart can be vertically zoomed through user interactions.
    */
    get isVerticalZoomEnabled() {
        return this.i.a3;
    }
    set isVerticalZoomEnabled(v) {
        this.i.a3 = ensureBool(v);
    }
    /**
     * Gets or sets the rectangle representing the current scroll and zoom state of the chart.
     * WindowRect is expressed as a Rectangle with coordinates and sizes between 0 and 1.
    */
    get windowRect() {
        return fromRect(this.i.gj);
    }
    set windowRect(v) {
        this.i.gj = toRect(v);
    }
    /**
     * Gets a rectangle representing the bounds of the plot area.
    */
    get viewport() {
        return fromRect(this.i.gi);
    }
    /**
     * Gets or sets text to display above the plot area.
    */
    get chartTitle() {
        return this.i.dx;
    }
    set chartTitle(v) {
        this.i.dx = v;
    }
    /**
     * Gets or sets text to display below the Title, above the plot area.
    */
    get subtitle() {
        return this.i.dl;
    }
    set subtitle(v) {
        this.i.dl = v;
    }
    /**
     * Gets or sets horizontal alignment which determines the title position, relative to the left and right edges of the control.
    */
    get titleAlignment() {
        return this.i.f7;
    }
    set titleAlignment(v) {
        this.i.f7 = ensureEnum(HorizontalAlignment_$type, v);
    }
    /**
     * Gets or sets horizontal alignment which determines the subtitle position, relative to the left and right edges of the control.
    */
    get subtitleAlignment() {
        return this.i.f6;
    }
    set subtitleAlignment(v) {
        this.i.f6 = ensureEnum(HorizontalAlignment_$type, v);
    }
    /**
     * Gets or sets the behavior that determines how unknown values will be plotted on the chart.
     * Null and Double.NaN are two examples of unknown values.
    */
    get unknownValuePlotting() {
        return this.i.ak;
    }
    set unknownValuePlotting(v) {
        this.i.ak = ensureEnum(UnknownValuePlotting_$type, v);
    }
    /**
     * 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 resolution() {
        return this.i.by;
    }
    set resolution(v) {
        this.i.by = +v;
    }
    /**
     * Gets or sets the thickness for all series in this chart. Depending on the ChartType, this can be the main brush used, or just the outline.
    */
    get thickness() {
        return this.i.b4;
    }
    set thickness(v) {
        this.i.b4 = +v;
    }
    /**
     * Gets or sets the marker shapes used for indicating location of data points in this chart.
     * This property applies only to these chart types: point, line, spline, bubble, and polygon
    */
    get markerTypes() {
        if (this._markerTypes === null) {
            let coll = new MarkerTypeCollection();
            let innerColl = this.i.af;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new MarkerTypeCollection_internal();
            }
            this._markerTypes = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.af = innerColl;
            }
        }
        return this._markerTypes;
    }
    set markerTypes(v) {
        let coll = new MarkerTypeCollection();
        this._markerTypes = coll._fromOuter(v);
        let innerColl = new MarkerTypeCollection_internal();
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.af = innerColl;
    }
    /**
     * Gets or sets the palette of brushes used for rendering fill area of data point markers.
     * This property applies only to these chart types: point, line, spline, bubble, and polygon
    */
    get markerBrushes() {
        return fromBrushCollection(this.i.l);
    }
    set markerBrushes(v) {
        this.i.l = toBrushCollection(v);
    }
    /**
     * Gets or sets the palette of brushes used for rendering outlines of data point markers.
     * This property applies only to these chart types: point, line, spline, bubble, and polygon
    */
    get markerOutlines() {
        return fromBrushCollection(this.i.m);
    }
    set markerOutlines(v) {
        this.i.m = toBrushCollection(v);
    }
    /**
     * Gets or sets the maximum number of markers displyed in the plot area of the chart.
    */
    get markerMaxCount() {
        return this.i.ch;
    }
    set markerMaxCount(v) {
        this.i.ch = +v;
    }
    /**
     * Gets or sets whether the series animations should be allowed when a range change has been detected on an axis.
    */
    get animateSeriesWhenAxisRangeChanges() {
        return this.i.av;
    }
    set animateSeriesWhenAxisRangeChanges(v) {
        this.i.av = ensureBool(v);
    }
    /**
     * Gets or sets the palette of brushes to used for coloring trend lines in this chart.
     * The value provided should be an array of CSS color strings or JavaScript objects defining gradients. Optionally the first element can be a string reading "RGB" or "HSV" to specify the interpolation mode of the collection
    */
    get trendLineBrushes() {
        return fromBrushCollection(this.i.o);
    }
    set trendLineBrushes(v) {
        this.i.o = toBrushCollection(v);
    }
    /**
     * Gets or sets the formula used for calculating trend lines in this chart.
     * This property applies only to these chart types: point, line, spline, and bubble
    */
    get trendLineType() {
        return this.i.ai;
    }
    set trendLineType(v) {
        this.i.ai = ensureEnum(TrendLineType_$type, v);
    }
    /**
     * Gets or sets the thickness of the trend lines in this chart.
     * This property applies only to these chart types: point, line, spline, and bubble
    */
    get trendLineThickness() {
        return this.i.ca;
    }
    set trendLineThickness(v) {
        this.i.ca = +v;
    }
    /**
     * Gets or sets a value indicating whether grid and tick lines are aligned to device pixels.
    */
    get alignsGridLinesToPixels() {
        return this.i.au;
    }
    set alignsGridLinesToPixels(v) {
        this.i.au = ensureBool(v);
    }
    get trendLinePeriod() {
        return this.i.cj;
    }
    set trendLinePeriod(v) {
        this.i.cj = +v;
    }
    /**
     * Provides a container for this control
    
    */
    provideContainer(container) {
        this.i.provideContainer(container);
    }
    /**
     * Destroy this control
    
    */
    destroy() {
        this.i.destroy();
    }
    /**
     * Called when the control has been resized.
    
    */
    notifyResized() {
        this.i.notifyResized();
    }
    notifyVisualPropertiesChanged() {
        this.i.fd();
    }
    /**
     * Forces any pending refresh to the chart to be finished.
    
    */
    flush() {
        this.i.ep();
    }
    /**
     * Hides the active main tooltip, if displayed.
    
    */
    hideToolTip() {
        this.i.es();
    }
    notifySetItem(source_, index, oldItem, newItem) {
        this.i.fc(source_, index, oldItem, newItem);
    }
    /**
     * Used to manually notify the chart that the data source has reset or cleared its items.
    
    */
    notifyClearItems(source_) {
        this.i.e8(source_);
    }
    notifyInsertItem(source_, index, newItem) {
        this.i.e9(source_, index, newItem);
    }
    notifyRemoveItem(source_, index, oldItem) {
        this.i.fa(source_, index, oldItem);
    }
    /**
     * Event raised when a series is initialized and added to this chart.
    */
    get seriesAdded() {
        return this._seriesAdded;
    }
    set seriesAdded(ev) {
        if (this._seriesAdded !== null) {
            this.i.seriesAdded = delegateRemove(this.i.seriesAdded, this._seriesAdded_wrapped);
            this._seriesAdded_wrapped = null;
            this._seriesAdded = null;
        }
        this._seriesAdded = ev;
        this._seriesAdded_wrapped = (o, e) => {
            let outerArgs = new ChartSeriesEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesAdded(this, outerArgs);
        };
        this.i.seriesAdded = delegateCombine(this.i.seriesAdded, this._seriesAdded_wrapped);
    }
    /**
     * Event raised when a series is removed from this chart.
    */
    get seriesRemoved() {
        return this._seriesRemoved;
    }
    set seriesRemoved(ev) {
        if (this._seriesRemoved !== null) {
            this.i.seriesRemoved = delegateRemove(this.i.seriesRemoved, this._seriesRemoved_wrapped);
            this._seriesRemoved_wrapped = null;
            this._seriesRemoved = null;
        }
        this._seriesRemoved = ev;
        this._seriesRemoved_wrapped = (o, e) => {
            let outerArgs = new ChartSeriesEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesRemoved(this, outerArgs);
        };
        this.i.seriesRemoved = delegateCombine(this.i.seriesRemoved, this._seriesRemoved_wrapped);
    }
    /**
     * Occurs when the pointer enters a Series.
    */
    get seriesPointerEnter() {
        return this._seriesPointerEnter;
    }
    set seriesPointerEnter(ev) {
        if (this._seriesPointerEnter !== null) {
            this.i.seriesPointerEnter = delegateRemove(this.i.seriesPointerEnter, this._seriesPointerEnter_wrapped);
            this._seriesPointerEnter_wrapped = null;
            this._seriesPointerEnter = null;
        }
        this._seriesPointerEnter = ev;
        this._seriesPointerEnter_wrapped = (o, e) => {
            let outerArgs = new DomainChartSeriesPointerEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesPointerEnter(this, outerArgs);
        };
        this.i.seriesPointerEnter = delegateCombine(this.i.seriesPointerEnter, this._seriesPointerEnter_wrapped);
    }
    /**
     * Occurs when the pointer leaves a Series.
    */
    get seriesPointerLeave() {
        return this._seriesPointerLeave;
    }
    set seriesPointerLeave(ev) {
        if (this._seriesPointerLeave !== null) {
            this.i.seriesPointerLeave = delegateRemove(this.i.seriesPointerLeave, this._seriesPointerLeave_wrapped);
            this._seriesPointerLeave_wrapped = null;
            this._seriesPointerLeave = null;
        }
        this._seriesPointerLeave = ev;
        this._seriesPointerLeave_wrapped = (o, e) => {
            let outerArgs = new DomainChartSeriesPointerEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesPointerLeave(this, outerArgs);
        };
        this.i.seriesPointerLeave = delegateCombine(this.i.seriesPointerLeave, this._seriesPointerLeave_wrapped);
    }
    /**
     * Occurs when the pointer moves over a Series.
    */
    get seriesPointerMove() {
        return this._seriesPointerMove;
    }
    set seriesPointerMove(ev) {
        if (this._seriesPointerMove !== null) {
            this.i.seriesPointerMove = delegateRemove(this.i.seriesPointerMove, this._seriesPointerMove_wrapped);
            this._seriesPointerMove_wrapped = null;
            this._seriesPointerMove = null;
        }
        this._seriesPointerMove = ev;
        this._seriesPointerMove_wrapped = (o, e) => {
            let outerArgs = new DomainChartSeriesPointerEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesPointerMove(this, outerArgs);
        };
        this.i.seriesPointerMove = delegateCombine(this.i.seriesPointerMove, this._seriesPointerMove_wrapped);
    }
    /**
     * Occurs when the pointer is pressed down over a Series.
    */
    get seriesPointerDown() {
        return this._seriesPointerDown;
    }
    set seriesPointerDown(ev) {
        if (this._seriesPointerDown !== null) {
            this.i.seriesPointerDown = delegateRemove(this.i.seriesPointerDown, this._seriesPointerDown_wrapped);
            this._seriesPointerDown_wrapped = null;
            this._seriesPointerDown = null;
        }
        this._seriesPointerDown = ev;
        this._seriesPointerDown_wrapped = (o, e) => {
            let outerArgs = new DomainChartSeriesPointerEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesPointerDown(this, outerArgs);
        };
        this.i.seriesPointerDown = delegateCombine(this.i.seriesPointerDown, this._seriesPointerDown_wrapped);
    }
    /**
     * Occurs when the pointer is released over a Series.
    */
    get seriesPointerUp() {
        return this._seriesPointerUp;
    }
    set seriesPointerUp(ev) {
        if (this._seriesPointerUp !== null) {
            this.i.seriesPointerUp = delegateRemove(this.i.seriesPointerUp, this._seriesPointerUp_wrapped);
            this._seriesPointerUp_wrapped = null;
            this._seriesPointerUp = null;
        }
        this._seriesPointerUp = ev;
        this._seriesPointerUp_wrapped = (o, e) => {
            let outerArgs = new DomainChartSeriesPointerEventArgs();
            outerArgs._provideImplementation(e);
            this._seriesPointerUp(this, outerArgs);
        };
        this.i.seriesPointerUp = delegateCombine(this.i.seriesPointerUp, this._seriesPointerUp_wrapped);
    }
}
