var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { useMemo } from 'react';
import { makeStyles } from '@material-ui/core';
import { UdpBarChart } from '../../../charts/amcharts/UdpBarChart';
import { UdpLineChart } from '../../../charts/amcharts/UdpLineChart';
import { UdpDistributionChart } from '../../../charts/amcharts/UdpDistributionChart';
import { UdpDonutChart } from '../../../charts/amcharts/UdpDonutChart';
import { UdpSankeyChart } from '../../../charts/amcharts/UdpSankeyChart';
import { UdpXYMultiSeriesChart } from '../../../charts/amcharts/UdpXYMultiSeriesChart';
const useStyles = makeStyles(() => ({
    chartWrapper: {
        height: '100%',
        width: '100%'
    }
}));
export const AmChart = (props) => {
    const { chartType, data, dataMappingField, labelFormat, tooltipTextFormat } = props, otherProps = __rest(props, ["chartType", "data", "dataMappingField", "labelFormat", "tooltipTextFormat"]);
    const classes = useStyles();
    const chart = useMemo(() => {
        switch (chartType) {
            case 'sankey':
                return (React.createElement(UdpSankeyChart, Object.assign({ data: data, valueField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.valueField, targetIdField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.targetIdField, sourceIdField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.sourceIdField, labelFormat: labelFormat, tooltipTextFormat: tooltipTextFormat }, otherProps)));
            case 'bar':
                return (React.createElement(UdpBarChart, Object.assign({ data: data, valueField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.valueField, labelField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.labelField }, otherProps)));
            case 'donut':
                return (React.createElement(UdpDonutChart, Object.assign({ data: data, valueField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.valueField, labelField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.labelField, hideLegend: false }, otherProps)));
            case 'line':
                return (React.createElement(UdpLineChart, Object.assign({ data: data, xAxisField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.xAxisField, yAxisField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.yAxisField }, otherProps)));
            case 'distribution':
                return (React.createElement(UdpDistributionChart, Object.assign({ data: data, valueField: dataMappingField === null || dataMappingField === void 0 ? void 0 : dataMappingField.valueField }, otherProps)));
            case 'xyMultiSeries':
                return (React.createElement(UdpXYMultiSeriesChart, Object.assign({ hideLegend: false, xAxes: [], yAxes: [], series: [], data: data }, otherProps)));
            default:
                return null;
        }
    }, [
        chartType,
        data,
        dataMappingField,
        labelFormat,
        otherProps,
        tooltipTextFormat
    ]);
    return React.createElement("div", { className: classes.chartWrapper }, chart);
};
//# sourceMappingURL=AmChart.js.map