void MapObject(PlotArea plotArea, DocumentObjectModel.Shapes.Charts.PlotArea domPlotArea) { plotArea.BottomPadding = domPlotArea.BottomPadding.Point; plotArea.RightPadding = domPlotArea.RightPadding.Point; plotArea.LeftPadding = domPlotArea.LeftPadding.Point; plotArea.TopPadding = domPlotArea.TopPadding.Point; if (!domPlotArea.IsNull("LineFormat")) { LineFormatMapper.Map(plotArea.LineFormat, domPlotArea.LineFormat); } if (!domPlotArea.IsNull("FillFormat")) { FillFormatMapper.Map(plotArea.FillFormat, domPlotArea.FillFormat); } }
internal static void Map(FillFormat fillFormat, DocumentObjectModel.Shapes.FillFormat domFillFormat) { FillFormatMapper mapper = new FillFormatMapper(); mapper.MapObject(fillFormat, domFillFormat); }
void MapObject(SeriesCollection seriesCollection, DocumentObjectModel.Shapes.Charts.SeriesCollection domSeriesCollection) { foreach (DocumentObjectModel.Shapes.Charts.Series domSeries in domSeriesCollection) { Series series = seriesCollection.AddSeries(); series.Name = domSeries.Name; if (domSeries.IsNull("ChartType")) { DocumentObjectModel.Shapes.Charts.Chart chart = (DocumentObjectModel.Shapes.Charts.Chart)DocumentObjectModel.DocumentRelations.GetParentOfType(domSeries, typeof(DocumentObjectModel.Shapes.Charts.Chart)); series.ChartType = (ChartType)chart.Type; } else { series.ChartType = (ChartType)domSeries.ChartType; } if (!domSeries.IsNull("DataLabel")) { DataLabelMapper.Map(series.DataLabel, domSeries.DataLabel); } if (!domSeries.IsNull("LineFormat")) { LineFormatMapper.Map(series.LineFormat, domSeries.LineFormat); } if (!domSeries.IsNull("FillFormat")) { FillFormatMapper.Map(series.FillFormat, domSeries.FillFormat); } series.HasDataLabel = domSeries.HasDataLabel; if (domSeries.MarkerBackgroundColor.IsEmpty) { series.MarkerBackgroundColor = XColor.Empty; } else { #if noCMYK series.MarkerBackgroundColor = XColor.FromArgb(domSeries.MarkerBackgroundColor.Argb); #else series.MarkerBackgroundColor = ColorHelper.ToXColor(domSeries.MarkerBackgroundColor, domSeries.Document.UseCmykColor); #endif } if (domSeries.MarkerForegroundColor.IsEmpty) { series.MarkerForegroundColor = XColor.Empty; } else { #if noCMYK series.MarkerForegroundColor = XColor.FromArgb(domSeries.MarkerForegroundColor.Argb); #else series.MarkerForegroundColor = ColorHelper.ToXColor(domSeries.MarkerForegroundColor, domSeries.Document.UseCmykColor); #endif } series.MarkerSize = domSeries.MarkerSize.Point; if (!domSeries.IsNull("MarkerStyle")) { series.MarkerStyle = (MarkerStyle)domSeries.MarkerStyle; } foreach (DocumentObjectModel.Shapes.Charts.Point domPoint in domSeries.Elements) { if (domPoint != null) { Point point = series.Add(domPoint.Value); FillFormatMapper.Map(point.FillFormat, domPoint.FillFormat); LineFormatMapper.Map(point.LineFormat, domPoint.LineFormat); } else { series.Add(double.NaN); } } } }