"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildSeries3D = exports.buildSeries = void 0;
var DataPointSelectionPaletteProvider_1 = require("../Charting/Model/DataPointSelectionPaletteProvider");
var IDataSeries_1 = require("../Charting/Model/IDataSeries");
var IPointMetadata_1 = require("../Charting/Model/IPointMetadata");
var PaletteFactory_1 = require("../Charting/Model/PaletteFactory");
var CrossPointMarker_1 = require("../Charting/Visuals/PointMarkers/CrossPointMarker");
var EllipsePointMarker_1 = require("../Charting/Visuals/PointMarkers/EllipsePointMarker");
var SpritePointMarker_1 = require("../Charting/Visuals/PointMarkers/SpritePointMarker");
var SquarePointMarker_1 = require("../Charting/Visuals/PointMarkers/SquarePointMarker");
var TrianglePointMarker_1 = require("../Charting/Visuals/PointMarkers/TrianglePointMarker");
var XPointMarker_1 = require("../Charting/Visuals/PointMarkers/XPointMarker");
var FadeAnimation_1 = require("../Charting/Visuals/RenderableSeries/Animations/FadeAnimation");
var ScaleAnimation_1 = require("../Charting/Visuals/RenderableSeries/Animations/ScaleAnimation");
var SweepAnimation_1 = require("../Charting/Visuals/RenderableSeries/Animations/SweepAnimation");
var WaveAnimation_1 = require("../Charting/Visuals/RenderableSeries/Animations/WaveAnimation");
var BandSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/BandSeriesDataLabelProvider");
var BubbleSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/BubbleSeriesDataLabelProvider");
var ColumnSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/ColumnSeriesDataLabelProvider");
var ContoursDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/ContoursDataLabelProvider");
var DataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/DataLabelProvider");
var HeatMapDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/HeatMapDataLabelProvider");
var LineSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/LineSeriesDataLabelProvider");
var NonUniformHeatmapDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/NonUniformHeatmapDataLabelProvider");
var TextDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/TextDataLabelProvider");
var FastBandRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastBandRenderableSeries");
var FastBubbleRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries");
var FastCandlestickRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastCandlestickRenderableSeries");
var FastColumnRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastColumnRenderableSeries");
var FastErrorBarsRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries");
var FastImpulseRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastImpulseRenderableSeries");
var FastLineRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastLineRenderableSeries");
var FastMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastMountainRenderableSeries");
var FastOhlcRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastOhlcRenderableSeries");
var FastTextRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastTextRenderableSeries");
var GlowEffect_1 = require("../Charting/Visuals/RenderableSeries/GlowEffect");
var NonUniformHeatmapRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/NonUniformHeatmapRenderableSeries");
var ShadowEffect_1 = require("../Charting/Visuals/RenderableSeries/ShadowEffect");
var SplineBandRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/SplineBandRenderableSeries");
var SplineLineRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/SplineLineRenderableSeries");
var SplineMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries");
var SmoothStackedMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/SmoothStackedMountainRenderableSeries");
var StackedColumnCollection_1 = require("../Charting/Visuals/RenderableSeries/StackedColumnCollection");
var StackedColumnRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries");
var StackedMountainCollection_1 = require("../Charting/Visuals/RenderableSeries/StackedMountainCollection");
var StackedMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries");
var UniformContoursRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries");
var UniformHeatmapRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries");
var XyScatterRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/XyScatterRenderableSeries");
var AnimationType_1 = require("../types/AnimationType");
var BaseType_1 = require("../types/BaseType");
var DataLabelProviderType_1 = require("../types/DataLabelProviderType");
var PaletteProviderType_1 = require("../types/PaletteProviderType");
var PointMarkerType_1 = require("../types/PointMarkerType");
var SeriesType_1 = require("../types/SeriesType");
var ShaderEffectType_1 = require("../types/ShaderEffectType");
var buildDataSeries_1 = require("./buildDataSeries");
var chartReviver_1 = require("./helpers/chartReviver");
var classFactory_1 = require("../Core/classFactory");
var FastLineSegmentRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastLineSegmentRenderableSeries");
var FastRectangleRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastRectangleRenderableSeries");
var PolarLineRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarLineRenderableSeries");
var PolarBandRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarBandRenderableSeries");
var PolarColumnRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarColumnRenderableSeries");
var PolarMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarMountainRenderableSeries");
var PolarStackedMountainRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarStackedMountainRenderableSeries");
var FastBoxPlotRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastBoxPlotRenderableSeries");
var FastTriangleRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/FastTriangleRenderableSeries");
var PolarXyScatterRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarXyScatterRenderableSeries");
var PolarDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/Polar/DataLabels/PolarDataLabelProvider");
var PolarColumnSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/Polar/DataLabels/PolarColumnSeriesDataLabelProvider");
var PolarStackedMountainCollection_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarStackedMountainCollection");
var PolarStackedColumnCollection_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarStackedColumnCollection");
var PolarStackedColumnRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarStackedColumnRenderableSeries");
var PolarUniformHeatmapRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarUniformHeatmapRenderableSeries");
var ESeriesType_1 = require("../Charting3D/Visuals/RenderableSeries/ESeriesType");
var ColumnRenderableSeries3D_1 = require("../Charting3D/Visuals/RenderableSeries/ColumnRenderableSeries3D");
var PointLineRenderableSeries3D_1 = require("../Charting3D/Visuals/RenderableSeries/PointLineRenderableSeries3D");
var ScatterRenderableSeries3D_1 = require("../Charting3D/Visuals/RenderableSeries/ScatterRenderableSeries3D");
var SurfaceMeshRenderableSeries3D_1 = require("../Charting3D/Visuals/RenderableSeries/SurfaceMesh/SurfaceMeshRenderableSeries3D");
var BaseDataSeries3D_1 = require("../Charting3D/Model/DataSeries/BaseDataSeries3D");
var PointMarker3DType_1 = require("../types/PointMarker3DType");
var DefaultPointMarkers_1 = require("../Charting3D/Visuals/PointMarkers/DefaultPointMarkers");
var RectangleSeriesDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/DataLabels/RectangleSeriesDataLabelProvider");
var GradientColorPalette_1 = require("../Charting3D/Visuals/RenderableSeries/SurfaceMesh/GradientColorPalette");
var SolidColorBrushPalette_1 = require("../Charting3D/Visuals/RenderableSeries/SurfaceMesh/SolidColorBrushPalette");
var PolarTextDataLabelProvider_1 = require("../Charting/Visuals/RenderableSeries/Polar/DataLabels/PolarTextDataLabelProvider");
var PolarTriangleRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarTriangleRenderableSeries");
var PolarTextRenderableSeries_1 = require("../Charting/Visuals/RenderableSeries/Polar/PolarTextRenderableSeries");
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.Cross, function (wasm, options) { return new CrossPointMarker_1.CrossPointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.Ellipse, function (wasm, options) { return new EllipsePointMarker_1.EllipsePointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.Sprite, function (wasm, options) { return new SpritePointMarker_1.SpritePointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.Square, function (wasm, options) { return new SquarePointMarker_1.SquarePointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.Triangle, function (wasm, options) { return new TrianglePointMarker_1.TrianglePointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker, PointMarkerType_1.EPointMarkerType.X, function (wasm, options) { return new XPointMarker_1.XPointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.ShaderEffect, ShaderEffectType_1.EShaderEffectType.Glow, function (wasm, options) { return new GlowEffect_1.GlowEffect(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.ShaderEffect, ShaderEffectType_1.EShaderEffectType.Shadow, function (wasm, options) { return new ShadowEffect_1.ShadowEffect(wasm, options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Animation, AnimationType_1.EAnimationType.Fade, function (options) { return new FadeAnimation_1.FadeAnimation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Animation, AnimationType_1.EAnimationType.Scale, function (options) { return new ScaleAnimation_1.ScaleAnimation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Animation, AnimationType_1.EAnimationType.Sweep, function (options) { return new SweepAnimation_1.SweepAnimation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Animation, AnimationType_1.EAnimationType.Wave, function (options) { return new WaveAnimation_1.WaveAnimation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Default, function (options) { return new DataLabelProvider_1.DataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Line, function (options) { return new LineSeriesDataLabelProvider_1.LineSeriesDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Column, function (options) { return new ColumnSeriesDataLabelProvider_1.ColumnSeriesDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Rectangle, function (options) { return new RectangleSeriesDataLabelProvider_1.RectangleSeriesDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Text, function (options) { return new TextDataLabelProvider_1.TextDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Heatmap, function (options) { return new HeatMapDataLabelProvider_1.HeatMapDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.NonUniformHeatmap, function (options) { return new NonUniformHeatmapDataLabelProvider_1.NonUniformHeatMapDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Bubble, function (options) { return new BubbleSeriesDataLabelProvider_1.BubbleSeriesDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Band, function (options) { return new BandSeriesDataLabelProvider_1.BandSeriesDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.Contours, function (options) { return new ContoursDataLabelProvider_1.ContoursDataLabelProvider(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.PolarDefault, function (options) { return new PolarDataLabelProvider_1.PolarDataLabelProvider(options); });
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.PolarColumn, function (options) { return new PolarColumnSeriesDataLabelProvider_1.PolarColumnSeriesDataLabelProvider(options); });
(0, classFactory_1.registerType)(BaseType_1.EBaseType.DataLabelProvider, DataLabelProviderType_1.EDataLabelProviderType.PolarText, function (options) { return new PolarTextDataLabelProvider_1.PolarTextDataLabelProvider(options); });
// Metadata
(0, classFactory_1.registerType)(BaseType_1.EBaseType.MetadataGenerator, "Template", function (template) { return new IPointMetadata_1.TemplateMetadataGenerator(template); }, true);
// PaletteProviders
// Default palette provider is not required as it is created automatically if none is provided.
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PaletteProvider, PaletteProviderType_1.EPaletteProviderType.Gradient, function (wasmContext, gradientBrush) { return PaletteFactory_1.PaletteFactory.createGradient(wasmContext, gradientBrush); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.PaletteProvider, PaletteProviderType_1.EPaletteProviderType.DataPointSelection, function (selectedStyle) { return new DataPointSelectionPaletteProvider_1.DataPointSelectionPaletteProvider(selectedStyle); }, true);
function hasOwnProperty(obj, prop) {
    return obj.hasOwnProperty(prop);
}
var getDataSeriesDefinition = function (seriesDefinition) {
    if (hasOwnProperty(seriesDefinition, "xyData")) {
        return { type: IDataSeries_1.EDataSeriesType.Xy, options: seriesDefinition.xyData };
    }
    else if (hasOwnProperty(seriesDefinition, "xyyData")) {
        return { type: IDataSeries_1.EDataSeriesType.Xyy, options: seriesDefinition.xyyData };
    }
    else if (hasOwnProperty(seriesDefinition, "xyzData")) {
        return { type: IDataSeries_1.EDataSeriesType.Xyz, options: seriesDefinition.xyzData };
    }
    else if (hasOwnProperty(seriesDefinition, "xyxyData")) {
        return { type: IDataSeries_1.EDataSeriesType.Xyxy, options: seriesDefinition.xyxyData };
    }
    else if (hasOwnProperty(seriesDefinition, "xyxData")) {
        return { type: IDataSeries_1.EDataSeriesType.Xyx, options: seriesDefinition.xyxData };
    }
    else if (hasOwnProperty(seriesDefinition, "xynData")) {
        return { type: IDataSeries_1.EDataSeriesType.XyN, options: seriesDefinition.xynData };
    }
    else if (hasOwnProperty(seriesDefinition, "xyTextData")) {
        return { type: IDataSeries_1.EDataSeriesType.XyText, options: seriesDefinition.xyTextData };
    }
    else if (hasOwnProperty(seriesDefinition, "hlcData")) {
        return { type: IDataSeries_1.EDataSeriesType.Hlc, options: seriesDefinition.hlcData };
    }
    else if (hasOwnProperty(seriesDefinition, "ohlcData")) {
        return { type: IDataSeries_1.EDataSeriesType.Ohlc, options: seriesDefinition.ohlcData };
    }
    else if (hasOwnProperty(seriesDefinition, "boxPlotData")) {
        return { type: IDataSeries_1.EDataSeriesType.BoxPlot, options: seriesDefinition.boxPlotData };
    }
    else if (hasOwnProperty(seriesDefinition, "heatmapData") &&
        (seriesDefinition.type === SeriesType_1.ESeriesType.UniformHeatmapSeries ||
            seriesDefinition.type === SeriesType_1.ESeriesType.UniformContoursSeries ||
            seriesDefinition.type === SeriesType_1.ESeriesType.PolarUniformHeatmapSeries)) {
        return { type: IDataSeries_1.EDataSeriesType.HeatmapUniform, options: seriesDefinition.heatmapData };
    }
    else if (hasOwnProperty(seriesDefinition, "heatmapData") &&
        seriesDefinition.type === SeriesType_1.ESeriesType.NonUniformHeatmapSeries) {
        return { type: IDataSeries_1.EDataSeriesType.HeatmapNonUniform, options: seriesDefinition.heatmapData };
    }
    else {
        return undefined;
    }
};
/**
 * Build one or more renderable series from a definition that can be pure data.
 * @param wasmContext A {@link TSciChart | SciChart 2D WebAssembly Context}
 * @param definition One or an array of {@link TSeriesDefinition}
 * @param sharedData Optional {@link TSharedDataDefinition} to define shared data which can be referenced by the renderable series
 * @returns An array of {@link IRenderableSeries}.
 */
var buildSeries = function (wasmContext, definition, sharedData) {
    if (typeof definition === "string") {
        definition = JSON.parse(definition, chartReviver_1.chartReviver);
    }
    if (typeof sharedData === "string") {
        sharedData = JSON.parse(sharedData, chartReviver_1.chartReviver);
    }
    var result = [];
    if (!Array.isArray(definition)) {
        definition = [definition];
    }
    for (var _i = 0, definition_1 = definition; _i < definition_1.length; _i++) {
        var seriesDef = definition_1[_i];
        var series = void 0;
        if (seriesDef.type === SeriesType_1.ESeriesType.BandSeries) {
            series = new FastBandRenderableSeries_1.FastBandRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.BubbleSeries) {
            series = new FastBubbleRenderableSeries_1.FastBubbleRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.CandlestickSeries) {
            series = new FastCandlestickRenderableSeries_1.FastCandlestickRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.ColumnSeries) {
            series = new FastColumnRenderableSeries_1.FastColumnRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.ImpulseSeries) {
            series = new FastImpulseRenderableSeries_1.FastImpulseRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.LineSeries) {
            series = new FastLineRenderableSeries_1.FastLineRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.LineSegmentSeries) {
            series = new FastLineSegmentRenderableSeries_1.FastLineSegmentRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.MountainSeries) {
            series = new FastMountainRenderableSeries_1.FastMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.ErrorBarsSeries) {
            series = new FastErrorBarsRenderableSeries_1.FastErrorBarsRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.BoxPlotSeries) {
            series = new FastBoxPlotRenderableSeries_1.FastBoxPlotRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.TriangleSeries) {
            series = new FastTriangleRenderableSeries_1.FastTriangleRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.RectangleSeries) {
            series = new FastRectangleRenderableSeries_1.FastRectangleRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.OhlcSeries) {
            series = new FastOhlcRenderableSeries_1.FastOhlcRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.ScatterSeries) {
            series = new XyScatterRenderableSeries_1.XyScatterRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.SplineBandSeries) {
            series = new SplineBandRenderableSeries_1.SplineBandRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.SplineLineSeries) {
            series = new SplineLineRenderableSeries_1.SplineLineRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.SplineMountainSeries) {
            series = new SplineMountainRenderableSeries_1.SplineMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.UniformHeatmapSeries) {
            series = new UniformHeatmapRenderableSeries_1.UniformHeatmapRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.NonUniformHeatmapSeries) {
            series = new NonUniformHeatmapRenderableSeries_1.NonUniformHeatmapRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.UniformContoursSeries) {
            series = new UniformContoursRenderableSeries_1.UniformContoursRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.TextSeries) {
            series = new FastTextRenderableSeries_1.FastTextRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.StackedColumnSeries) {
            series = new StackedColumnRenderableSeries_1.StackedColumnRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.StackedMountainSeries) {
            series = new StackedMountainRenderableSeries_1.StackedMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.SmoothStackedMountainSeries) {
            series = new SmoothStackedMountainRenderableSeries_1.SmoothStackedMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.StackedColumnCollection) {
            var col = new StackedColumnCollection_1.StackedColumnCollection(wasmContext, seriesDef.options);
            col.add.apply(col, (0, exports.buildSeries)(wasmContext, seriesDef.series, sharedData));
            series = col;
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.StackedMountainCollection) {
            var col = new StackedMountainCollection_1.StackedMountainCollection(wasmContext, seriesDef.options);
            col.add.apply(col, (0, exports.buildSeries)(wasmContext, seriesDef.series, sharedData));
            series = col;
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarLineSeries) {
            series = new PolarLineRenderableSeries_1.PolarLineRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarScatterSeries) {
            series = new PolarXyScatterRenderableSeries_1.PolarXyScatterRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarBandSeries) {
            series = new PolarBandRenderableSeries_1.PolarBandRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarColumnSeries) {
            series = new PolarColumnRenderableSeries_1.PolarColumnRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarMountainSeries) {
            series = new PolarMountainRenderableSeries_1.PolarMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarTriangleSeries) {
            series = new PolarTriangleRenderableSeries_1.PolarTriangleRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarTextSeries) {
            series = new PolarTextRenderableSeries_1.PolarTextRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarUniformHeatmapSeries) {
            series = new PolarUniformHeatmapRenderableSeries_1.PolarUniformHeatmapRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarStackedMountainSeries) {
            series = new PolarStackedMountainRenderableSeries_1.PolarStackedMountainRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarStackedColumnSeries) {
            series = new PolarStackedColumnRenderableSeries_1.PolarStackedColumnRenderableSeries(wasmContext, seriesDef.options);
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarStackedMountainCollection) {
            var col = new PolarStackedMountainCollection_1.PolarStackedMountainCollection(wasmContext, seriesDef.options);
            col.add.apply(col, (0, exports.buildSeries)(wasmContext, seriesDef.series, sharedData));
            series = col;
        }
        else if (seriesDef.type === SeriesType_1.ESeriesType.PolarStackedColumnCollection) {
            var col = new PolarStackedColumnCollection_1.PolarStackedColumnCollection(wasmContext, seriesDef.options);
            col.add.apply(col, (0, exports.buildSeries)(wasmContext, seriesDef.series, sharedData));
            series = col;
        }
        if (series) {
            var dataSeries = getDataSeriesFromRenderableSeriesDefinition(wasmContext, seriesDef, sharedData);
            if (dataSeries) {
                series.dataSeries = dataSeries;
            }
        }
        if (series) {
            result.push(series);
        }
    }
    return result;
};
exports.buildSeries = buildSeries;
var getDataSeriesFromRenderableSeriesDefinition = function (wasmContext, renderableSeriesDefinition, sharedData) {
    var dataSeriesDefinition = getDataSeriesDefinition(renderableSeriesDefinition);
    if (!dataSeriesDefinition) {
        return undefined;
    }
    if (renderableSeriesDefinition.options &&
        "dataSeries" in renderableSeriesDefinition.options &&
        renderableSeriesDefinition.options.dataSeries &&
        dataSeriesDefinition.options &&
        "filter" in dataSeriesDefinition.options &&
        dataSeriesDefinition.options.filter) {
        return (0, buildDataSeries_1.buildDataSeries)(wasmContext, dataSeriesDefinition, sharedData, renderableSeriesDefinition.options.dataSeries);
    }
    return (0, buildDataSeries_1.buildDataSeries)(wasmContext, dataSeriesDefinition, sharedData);
};
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Sphere, function (wasm, options) { return new DefaultPointMarkers_1.SpherePointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Cube, function (wasm, options) { return new DefaultPointMarkers_1.CubePointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Pyramid, function (wasm, options) { return new DefaultPointMarkers_1.PyramidPointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Cylinder, function (wasm, options) { return new DefaultPointMarkers_1.CylinderPointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Ellipse, function (wasm, options) { return new DefaultPointMarkers_1.EllipsePointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Pixel, function (wasm, options) { return new DefaultPointMarkers_1.PixelPointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Quad, function (wasm, options) { return new DefaultPointMarkers_1.QuadPointMarker(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PointMarker3D, PointMarker3DType_1.EPointMarker3DType.Triangle, function (wasm, options) { return new DefaultPointMarkers_1.TrianglePointMarker3D(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PaletteProvider, PaletteProviderType_1.EPaletteProviderType.Gradient3D, function (wasm, options) { return new GradientColorPalette_1.GradientColorPalette(wasm, options); }, true);
(0, classFactory_1.registerWasmType)(BaseType_1.EBaseType.PaletteProvider, PaletteProviderType_1.EPaletteProviderType.Solid3D, function (wasm, options) { return new SolidColorBrushPalette_1.SolidColorBrushPalette(wasm, options); }, true);
/**
 * Build one or more 3D renderable series from a definition that can be pure data.
 * @param wasmContext A {@link TSciChart | SciChart 3D WebAssembly Context}
 * @param definition One or an array of {@link TSeriesDefinition3D}
 * @param sharedData Optional {@link TSharedDataDefinition} to define shared data which can be referenced by the renderable series
 * @returns An array of {@link IRenderableSeries3D}.
 */
var buildSeries3D = function (wasmContext, definition, sharedData) {
    if (typeof definition === "string") {
        definition = JSON.parse(definition, chartReviver_1.chartReviver);
    }
    if (typeof sharedData === "string") {
        sharedData = JSON.parse(sharedData, chartReviver_1.chartReviver);
    }
    var result = [];
    if (!Array.isArray(definition)) {
        definition = [definition];
    }
    for (var _i = 0, definition_2 = definition; _i < definition_2.length; _i++) {
        var seriesDef = definition_2[_i];
        var series = void 0;
        switch (seriesDef.type) {
            case ESeriesType_1.ESeriesType3D.ColumnRenderableSeries3D:
                series = new ColumnRenderableSeries3D_1.ColumnRenderableSeries3D(wasmContext, seriesDef.options);
                break;
            case ESeriesType_1.ESeriesType3D.PointLineRenderableSeries3D:
                series = new PointLineRenderableSeries3D_1.PointLineRenderableSeries3D(wasmContext, seriesDef.options);
                break;
            case ESeriesType_1.ESeriesType3D.ScatterRenderableSeries3D:
                series = new ScatterRenderableSeries3D_1.ScatterRenderableSeries3D(wasmContext, seriesDef.options);
                break;
            case ESeriesType_1.ESeriesType3D.SurfaceMeshRenderableSeries3D:
                series = new SurfaceMeshRenderableSeries3D_1.SurfaceMeshRenderableSeries3D(wasmContext, seriesDef.options);
                break;
        }
        if (series) {
            var dataSeries = getDataSeriesFromRenderableSeries3DDefinition(wasmContext, seriesDef, sharedData);
            if (dataSeries) {
                series.dataSeries = dataSeries;
            }
        }
        if (series) {
            result.push(series);
        }
    }
    return result;
};
exports.buildSeries3D = buildSeries3D;
var getDataSeriesFromRenderableSeries3DDefinition = function (wasmContext, renderableSeriesDefinition, sharedData) {
    var dataSeriesDefinition = getDataSeries3DDefinition(renderableSeriesDefinition);
    if (!dataSeriesDefinition) {
        return undefined;
    }
    return (0, buildDataSeries_1.buildDataSeries3D)(wasmContext, dataSeriesDefinition, sharedData);
};
var getDataSeries3DDefinition = function (seriesDefinition) {
    if (hasOwnProperty(seriesDefinition, "xyzData")) {
        return { type: BaseDataSeries3D_1.EDataSeriesType3D.Xyz3D, options: seriesDefinition.xyzData };
    }
    else if (hasOwnProperty(seriesDefinition, "uniformGridData")) {
        return { type: BaseDataSeries3D_1.EDataSeriesType3D.UniformGrid3D, options: seriesDefinition.uniformGridData };
    }
    else {
        return undefined;
    }
};
