private List <Hashtable> SeriesToHashtables(List <Series> listOfSeries) { List <Hashtable> hashtableList = new List <Hashtable>(); foreach (Series series in listOfSeries) { List <object> dataList = new List <object>(); Hashtable hashtable = new Hashtable(); if (series is LineSeries) { LineSeries lineSeries = series as LineSeries; lineSeries.Data.ForEach( (Action <LineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); lineSeries.Type = LineSeriesType.Line; hashtable = lineSeries.ToHashtable(); } if (series is SplineSeries) { SplineSeries splineSeries = series as SplineSeries; splineSeries.Data.ForEach((Action <SplineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); splineSeries.Type = SplineSeriesType.Spline; hashtable = splineSeries.ToHashtable(); } if (series is AreaSeries) { AreaSeries areaSeries = series as AreaSeries; areaSeries.Data.ForEach( (Action <AreaSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); areaSeries.Type = AreaSeriesType.Area; hashtable = areaSeries.ToHashtable(); } if (series is AreasplineSeries) { AreasplineSeries areasplineSeries = series as AreasplineSeries; areasplineSeries.Data.ForEach( (Action <AreasplineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); areasplineSeries.Type = AreasplineSeriesType.Areaspline; hashtable = areasplineSeries.ToHashtable(); } if (series is ArearangeSeries) { ArearangeSeries arearangeSeries = series as ArearangeSeries; arearangeSeries.Data.ForEach( (Action <ArearangeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); arearangeSeries.Type = ArearangeSeriesType.Arearange; hashtable = arearangeSeries.ToHashtable(); } if (series is ColumnrangeSeries) { ColumnrangeSeries columnrangeSeries = series as ColumnrangeSeries; columnrangeSeries.Data.ForEach( (Action <ColumnrangeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); columnrangeSeries.Type = ColumnrangeSeriesType.Columnrange; hashtable = columnrangeSeries.ToHashtable(); } if (series is BarSeries) { BarSeries barSeries = series as BarSeries; barSeries.Data.ForEach((Action <BarSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); barSeries.Type = BarSeriesType.Bar; hashtable = barSeries.ToHashtable(); } if (series is ColumnSeries) { ColumnSeries columnSeries = series as ColumnSeries; columnSeries.Data.ForEach((Action <ColumnSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); columnSeries.Type = ColumnSeriesType.Column; hashtable = columnSeries.ToHashtable(); } if (series is PieSeries) { PieSeries pieSeries = series as PieSeries; pieSeries.Data.ForEach((Action <PieSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); pieSeries.Type = PieSeriesType.Pie; hashtable = pieSeries.ToHashtable(); } if (series is ScatterSeries) { ScatterSeries scatterSeries = series as ScatterSeries; scatterSeries.Data.ForEach( (Action <ScatterSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); scatterSeries.Type = ScatterSeriesType.Scatter; hashtable = scatterSeries.ToHashtable(); } if (series is BubbleSeries) { BubbleSeries bubbleSeries = series as BubbleSeries; bubbleSeries.Data.ForEach((Action <BubbleSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); bubbleSeries.Type = BubbleSeriesType.Bubble; hashtable = bubbleSeries.ToHashtable(); } if (series is GaugeSeries) { GaugeSeries gaugeSeries = series as GaugeSeries; gaugeSeries.Data.ForEach((Action <GaugeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); gaugeSeries.Type = GaugeSeriesType.Gauge; hashtable = gaugeSeries.ToHashtable(); } if (series is SolidgaugeSeries) { SolidgaugeSeries solidgaugeSeries = series as SolidgaugeSeries; solidgaugeSeries.Data.ForEach( (Action <SolidgaugeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); solidgaugeSeries.Type = SolidgaugeSeriesType.Solidgauge; hashtable = solidgaugeSeries.ToHashtable(); } if (series is HeatmapSeries) { HeatmapSeries heatmapSeries = series as HeatmapSeries; heatmapSeries.Data.ForEach( (Action <HeatmapSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); heatmapSeries.Type = HeatmapSeriesType.Heatmap; hashtable = heatmapSeries.ToHashtable(); } if (series is BoxplotSeries) { BoxplotSeries boxplotSeries = series as BoxplotSeries; boxplotSeries.Data.ForEach( (Action <BoxplotSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); boxplotSeries.Type = BoxplotSeriesType.Boxplot; hashtable = boxplotSeries.ToHashtable(); } if (series is ErrorbarSeries) { ErrorbarSeries errorbarSeries = series as ErrorbarSeries; errorbarSeries.Data.ForEach( (Action <ErrorbarSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); errorbarSeries.Type = ErrorbarSeriesType.Errorbar; hashtable = errorbarSeries.ToHashtable(); } if (series is FunnelSeries) { FunnelSeries funnelSeries = series as FunnelSeries; funnelSeries.Data.ForEach((Action <FunnelSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); funnelSeries.Type = FunnelSeriesType.Funnel; hashtable = funnelSeries.ToHashtable(); } if (series is PyramidSeries) { PyramidSeries pyramidSeries = series as PyramidSeries; pyramidSeries.Data.ForEach( (Action <PyramidSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); pyramidSeries.Type = PyramidSeriesType.Pyramid; hashtable = pyramidSeries.ToHashtable(); } if (series is WaterfallSeries) { WaterfallSeries waterfallSeries = series as WaterfallSeries; waterfallSeries.Data.ForEach( (Action <WaterfallSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); waterfallSeries.Type = WaterfallSeriesType.Waterfall; hashtable = waterfallSeries.ToHashtable(); } if (series is PolygonSeries) { PolygonSeries polygonSeries = series as PolygonSeries; polygonSeries.Data.ForEach( (Action <PolygonSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); polygonSeries.Type = PolygonSeriesType.Polygon; hashtable = polygonSeries.ToHashtable(); } if (series is TreemapSeries) { TreemapSeries treemapSeries = series as TreemapSeries; treemapSeries.Data.ForEach( (Action <TreemapSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); treemapSeries.Type = TreemapSeriesType.Treemap; hashtable = treemapSeries.ToHashtable(); } hashtableList.Add(hashtable); } return(hashtableList); }
private List <Hashtable> SeriesToHashtables(List <Series> listOfSeries) { List <Hashtable> hashtableList = new List <Hashtable>(); foreach (Series series in listOfSeries) { List <object> dataList = new List <object>(); Hashtable hashtable1 = new Hashtable(); if (series is LineSeries) { if (series.ToHashtable().ContainsKey((object)"data")) { Hashtable hashtable2 = series.ToHashtable(); hashtableList.Add(hashtable2); continue; } LineSeries lineSeries = series as LineSeries; lineSeries.Data.ForEach( (Action <LineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); lineSeries.Type = LineSeriesType.Line; hashtable1 = lineSeries.ToHashtable(); } if (series is SplineSeries) { SplineSeries splineSeries = series as SplineSeries; splineSeries.Data.ForEach((Action <SplineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); splineSeries.Type = SplineSeriesType.Spline; hashtable1 = splineSeries.ToHashtable(); } if (series is AreaSeries) { AreaSeries areaSeries = series as AreaSeries; areaSeries.Data.ForEach( (Action <AreaSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); areaSeries.Type = AreaSeriesType.Area; hashtable1 = areaSeries.ToHashtable(); } if (series is AreasplineSeries) { AreasplineSeries areasplineSeries = series as AreasplineSeries; areasplineSeries.Data.ForEach( (Action <AreasplineSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); areasplineSeries.Type = AreasplineSeriesType.Areaspline; hashtable1 = areasplineSeries.ToHashtable(); } if (series is AreasplinerangeSeries) { AreasplinerangeSeries areasplinerangeSeries = series as AreasplinerangeSeries; areasplinerangeSeries.Data.ForEach( (Action <AreasplinerangeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); areasplinerangeSeries.Type = AreasplinerangeSeriesType.Areasplinerange; hashtable1 = areasplinerangeSeries.ToHashtable(); } if (series is ArearangeSeries) { ArearangeSeries arearangeSeries = series as ArearangeSeries; arearangeSeries.Data.ForEach( (Action <ArearangeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); arearangeSeries.Type = ArearangeSeriesType.Arearange; hashtable1 = arearangeSeries.ToHashtable(); } if (series is ColumnrangeSeries) { ColumnrangeSeries columnrangeSeries = series as ColumnrangeSeries; columnrangeSeries.Data.ForEach( (Action <ColumnrangeSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); columnrangeSeries.Type = ColumnrangeSeriesType.Columnrange; hashtable1 = columnrangeSeries.ToHashtable(); } if (series is ColumnSeries) { ColumnSeries columnSeries = series as ColumnSeries; columnSeries.Data.ForEach((Action <ColumnSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); columnSeries.Type = ColumnSeriesType.Column; hashtable1 = columnSeries.ToHashtable(); } if (series is ScatterSeries) { ScatterSeries scatterSeries = series as ScatterSeries; scatterSeries.Data.ForEach( (Action <ScatterSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); scatterSeries.Type = ScatterSeriesType.Scatter; hashtable1 = scatterSeries.ToHashtable(); } if (series is PolygonSeries) { PolygonSeries polygonSeries = series as PolygonSeries; polygonSeries.Data.ForEach( (Action <PolygonSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); polygonSeries.Type = PolygonSeriesType.Polygon; hashtable1 = polygonSeries.ToHashtable(); } if (series is CandleStickSeries) { CandleStickSeries candleStickSeries = series as CandleStickSeries; candleStickSeries.Data.ForEach( (Action <CandleStickSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); candleStickSeries.Type = CandleStickSeriesType.Candlestick; hashtable1 = candleStickSeries.ToHashtable(); } if (series is FlagsSeries) { FlagsSeries flagsSeries = series as FlagsSeries; flagsSeries.Data.ForEach((Action <FlagsSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); flagsSeries.Type = FlagsSeriesType.Flags; hashtable1 = flagsSeries.ToHashtable(); } if (series is OhlcSeries) { OhlcSeries ohlcSeries = series as OhlcSeries; ohlcSeries.Data.ForEach( (Action <OhlcSeriesData>)(data => dataList.Add((object)data.ToHashtable()))); ohlcSeries.Type = OhlcSeriesType.Ohlc; hashtable1 = ohlcSeries.ToHashtable(); } hashtableList.Add(hashtable1); } return(hashtableList); }