void MapObject(DataLabel dataLabel, DocumentObjectModel.Shapes.Charts.DataLabel domDataLabel)
 {
     if (!domDataLabel.IsNull("Style"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Document, domDataLabel.Style);
     }
     if (!domDataLabel.IsNull("Font"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Font);
     }
     dataLabel.Format = domDataLabel.Format;
     if (!domDataLabel.IsNull("Position"))
     {
         dataLabel.Position = (DataLabelPosition)domDataLabel.Position;
     }
     if (!domDataLabel.IsNull("Type"))
     {
         dataLabel.Type = (DataLabelType)domDataLabel.Type;
     }
 }
示例#2
0
        void MapObject(Chart chart, DocumentObjectModel.Shapes.Charts.Chart domChart)
        {
            DocumentObjectModel.Shapes.Charts.Legend   domLegend = null;
            DocumentObjectModel.Shapes.Charts.TextArea textArea  = null;

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.BottomArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Bottom;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.BottomArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.RightArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Right;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.RightArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.LeftArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Left;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.LeftArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.TopArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Top;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.TopArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.HeaderArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Top;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.HeaderArea;
                }
            }

            foreach (DocumentObjectModel.DocumentObject domObj in domChart.FooterArea.Elements)
            {
                if (domObj is DocumentObjectModel.Shapes.Charts.Legend)
                {
                    chart.Legend.Docking = PdfSharpCore.Charting.DockingType.Bottom;
                    domLegend            = domObj as DocumentObjectModel.Shapes.Charts.Legend;
                    textArea             = domChart.FooterArea;
                }
            }

            if (domLegend != null)
            {
                if (!domLegend.IsNull("LineFormat"))
                {
                    LineFormatMapper.Map(chart.Legend.LineFormat, domLegend.LineFormat);
                }
                if (!textArea.IsNull("Style"))
                {
                    FontMapper.Map(chart.Legend.Font, textArea.Document, textArea.Style);
                }
                if (!domLegend.IsNull("Format.Font"))
                {
                    FontMapper.Map(chart.Legend.Font, domLegend.Format.Font);
                }
            }
        }
示例#3
0
        void MapObject(Axis axis, DocumentObjectModel.Shapes.Charts.Axis domAxis)
        {
            if (!domAxis.IsNull("TickLabels.Format"))
            {
                axis.TickLabels.Format = domAxis.TickLabels.Format;
            }
            if (!domAxis.IsNull("TickLabels.Style"))
            {
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Document, domAxis.TickLabels.Style);
            }
            if (!domAxis.IsNull("TickLabels.Font"))
            {
                FontMapper.Map(axis.TickLabels.Font, domAxis.TickLabels.Font);
            }

            if (!domAxis.IsNull("MajorTickMark"))
            {
                axis.MajorTickMark = (TickMarkType)domAxis.MajorTickMark;
            }
            if (!domAxis.IsNull("MinorTickMark"))
            {
                axis.MinorTickMark = (TickMarkType)domAxis.MinorTickMark;
            }

            if (!domAxis.IsNull("MajorTick"))
            {
                axis.MajorTick = domAxis.MajorTick;
            }
            if (!domAxis.IsNull("MinorTick"))
            {
                axis.MinorTick = domAxis.MinorTick;
            }

            if (!domAxis.IsNull("Title"))
            {
                axis.Title.Caption = domAxis.Title.Caption;
                if (!domAxis.IsNull("Title.Style"))
                {
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Document, domAxis.Title.Style);
                }
                if (!domAxis.IsNull("Title.Font"))
                {
                    FontMapper.Map(axis.Title.Font, domAxis.Title.Font);
                }
                axis.Title.Orientation       = domAxis.Title.Orientation.Value;
                axis.Title.Alignment         = (HorizontalAlignment)domAxis.Title.Alignment;
                axis.Title.VerticalAlignment = (VerticalAlignment)domAxis.Title.VerticalAlignment;
            }

            axis.HasMajorGridlines = domAxis.HasMajorGridlines;
            axis.HasMinorGridlines = domAxis.HasMinorGridlines;

            if (!domAxis.IsNull("MajorGridlines") && !domAxis.MajorGridlines.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.MajorGridlines.LineFormat, domAxis.MajorGridlines.LineFormat);
            }
            if (!domAxis.IsNull("MinorGridlines") && !domAxis.MinorGridlines.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.MinorGridlines.LineFormat, domAxis.MinorGridlines.LineFormat);
            }

            if (!domAxis.IsNull("MaximumScale"))
            {
                axis.MaximumScale = domAxis.MaximumScale;
            }
            if (!domAxis.IsNull("MinimumScale"))
            {
                axis.MinimumScale = domAxis.MinimumScale;
            }

            if (!domAxis.IsNull("LineFormat"))
            {
                LineFormatMapper.Map(axis.LineFormat, domAxis.LineFormat);
            }
        }