public Chart GenerateChart(string title)
        {
            // c:chart (Chart)
            Chart chart1 = new Chart();

            // c:title (Title)
            Title title1 = GenerateTitle(title, TITLE_FONT_SIZE);

            // c:plotArea (PlotArea)
            PlotArea plotArea1 = new PlotArea();

            // c:layout (Layout)
            Layout layout2 = new Layout();

            // c:lineChart (LineChart)
            LineChart lineChart1 = new LineChart();

            // c:grouping (Grouping)
            Grouping grouping1 = new Grouping() { Val = GroupingValues.Standard };

            // c:marker (Marker)
            ShowMarker showMarker1 = new ShowMarker() { Val = true };

            // c:axId (AxisId)
            AxisId axisId1 = new AxisId() { Val = (UInt32Value)54573696U };
            AxisId axisId2 = new AxisId() { Val = (UInt32Value)54657408U };

            lineChart1.Append(grouping1);
            lineChart1.Append(showMarker1);
            lineChart1.Append(axisId1);
            lineChart1.Append(axisId2);

            // c:dateAx (DateAxis)
            DateAxis dateAxis1 = GenerateDateAxis(axisId1, AxisPositionValues.Bottom, axisId2, TickLabelPositionValues.Low);

            // c:valAx (ValueAxis)
            ValueAxis valueAxis1 = GenerateValueAxis(axisId2, AxisPositionValues.Left, axisId1);

            // c:plotArea (PlotArea)
            plotArea1.Append(layout2);
            plotArea1.Append(lineChart1);
            plotArea1.Append(dateAxis1);
            plotArea1.Append(valueAxis1);

            // c:legend (Legend)
            Legend legend1 = GenerateLegend(LegendPositionValues.Bottom);

            // c:plotVisOnly (PlotVisibleOnly)
            PlotVisibleOnly plotVisibleOnly1 = new PlotVisibleOnly() { Val = true };

            chart1.Append(title1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);

            return chart1;
        }
        public Chart GenerateChart(string title)
        {
            // c:chart (Chart)
            Chart chart1 = new Chart();

            // c:title (Title)
            Title title1 = GenerateTitle(title, TITLE_FONT_SIZE);

            // c:plotArea (PlotArea)
            PlotArea plotArea1 = new PlotArea();
            // c:layout (Layout)
            Layout layout2 = new Layout();

            LineChart lineChart1 = new LineChart();
            Grouping grouping1 = new Grouping() { Val = GroupingValues.Standard };

            ShowMarker showMarker1 = new ShowMarker() { Val = true };
            AxisId axisId1 = new AxisId() { Val = (UInt32Value)102222464U };
            AxisId axisId2 = new AxisId() { Val = (UInt32Value)92672384U };

            lineChart1.Append(grouping1);
            lineChart1.Append(showMarker1);
            lineChart1.Append(axisId1);
            lineChart1.Append(axisId2);

            DateAxis dateAxis1 = GenerateDateAxis(axisId1, AxisPositionValues.Bottom, axisId2, TickLabelPositionValues.High);
            ValueAxis valueAxis1 = GenerateValueAxis(axisId2, AxisPositionValues.Left, axisId1);

            plotArea1.Append(layout2);
            plotArea1.Append(lineChart1);
            plotArea1.Append(dateAxis1);
            plotArea1.Append(valueAxis1);

            Legend legend1 = GenerateLegend(LegendPositionValues.Bottom);

            PlotVisibleOnly plotVisibleOnly1 = new PlotVisibleOnly() { Val = true };

            chart1.Append(title1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);

            return chart1;
        }
Example #3
0
        private static void GenerateChartPartContentLine(ChartPart part, string formulaCat, string formulaVal, string title)
        {
            C.ChartSpace chartSpace1 = new C.ChartSpace();
            chartSpace1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace1.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            chartSpace1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            chartSpace1.AddNamespaceDeclaration("mv", "urn:schemas-microsoft-com:mac:vml");
            chartSpace1.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");

            C.Chart chart1 = new C.Chart();

            C.Title title1 = new C.Title();

            C.ChartText chartText1 = new C.ChartText();

            C.RichText       richText1       = new C.RichText();
            A.BodyProperties bodyProperties3 = new A.BodyProperties();
            A.ListStyle      listStyle3      = new A.ListStyle();

            A.Paragraph paragraph3 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties3 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties3 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties3.Append(defaultRunProperties3);

            A.Run  run1  = new A.Run();
            A.Text text1 = new A.Text();
            text1.Text = title;

            run1.Append(text1);

            paragraph3.Append(paragraphProperties3);
            paragraph3.Append(run1);

            richText1.Append(bodyProperties3);
            richText1.Append(listStyle3);
            richText1.Append(paragraph3);

            chartText1.Append(richText1);
            C.Overlay overlay1 = new C.Overlay()
            {
                Val = false
            };

            title1.Append(chartText1);
            title1.Append(overlay1);

            C.PlotArea plotArea1 = new C.PlotArea();
            C.Layout   layout1   = new C.Layout();

            C.LineChart  lineChart1  = new C.LineChart();
            C.VaryColors varyColors1 = new C.VaryColors()
            {
                Val = false
            };


            C.LineChartSeries lineChartSeries1 = new C.LineChartSeries();
            C.Index           index1           = new C.Index()
            {
                Val = (UInt32Value)0U
            };
            C.Order order1 = new C.Order()
            {
                Val = (UInt32Value)0U
            };


            C.ChartShapeProperties chartShapeProperties1 = new C.ChartShapeProperties();

            A.Outline outline1 = new A.Outline()
            {
                Width = 19050, CompoundLineType = A.CompoundLineValues.Single
            };

            A.SolidFill        solidFill1        = new A.SolidFill();
            A.RgbColorModelHex rgbColorModelHex1 = new A.RgbColorModelHex()
            {
                Val = "3366CC"
            };

            solidFill1.Append(rgbColorModelHex1);

            outline1.Append(solidFill1);

            chartShapeProperties1.Append(outline1);

            C.Marker marker1 = new C.Marker();
            C.Symbol symbol1 = new C.Symbol()
            {
                Val = C.MarkerStyleValues.None
            };

            marker1.Append(symbol1);

            C.CategoryAxisData categoryAxisData1 = new C.CategoryAxisData();

            C.StringReference stringReference1 = new C.StringReference();
            C.Formula         formula1         = new C.Formula();
            formula1.Text = formulaCat;

            stringReference1.Append(formula1);

            categoryAxisData1.Append(stringReference1);

            C.Values values1 = new C.Values();

            C.NumberReference numberReference1 = new C.NumberReference();
            C.Formula         formula2         = new C.Formula();
            formula2.Text = formulaVal;

            numberReference1.Append(formula2);

            values1.Append(numberReference1);
            C.Smooth smooth1 = new C.Smooth()
            {
                Val = false
            };

            lineChartSeries1.Append(index1);
            lineChartSeries1.Append(order1);
            lineChartSeries1.Append(chartShapeProperties1);
            lineChartSeries1.Append(marker1);
            lineChartSeries1.Append(categoryAxisData1);
            lineChartSeries1.Append(values1);
            lineChartSeries1.Append(smooth1);
            C.AxisId axisId1 = new C.AxisId()
            {
                Val = (UInt32Value)1923141117U
            };
            C.AxisId axisId2 = new C.AxisId()
            {
                Val = (UInt32Value)2022561148U
            };

            lineChart1.Append(varyColors1);
            lineChart1.Append(lineChartSeries1);
            lineChart1.Append(axisId1);
            lineChart1.Append(axisId2);

            C.CategoryAxis categoryAxis1 = new C.CategoryAxis();
            C.AxisId       axisId3       = new C.AxisId()
            {
                Val = (UInt32Value)1923141117U
            };


            C.Scaling     scaling1     = new C.Scaling();
            C.Orientation orientation1 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling1.Append(orientation1);
            C.Delete delete1 = new C.Delete()
            {
                Val = false
            };
            C.AxisPosition axisPosition1 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Bottom
            };

            C.TextProperties textProperties1 = new C.TextProperties();
            A.BodyProperties bodyProperties1 = new A.BodyProperties();
            A.ListStyle      listStyle1      = new A.ListStyle();

            A.Paragraph paragraph1 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties1 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties1 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties1.Append(defaultRunProperties1);

            paragraph1.Append(paragraphProperties1);

            textProperties1.Append(bodyProperties1);
            textProperties1.Append(listStyle1);
            textProperties1.Append(paragraph1);
            C.CrossingAxis crossingAxis1 = new C.CrossingAxis()
            {
                Val = (UInt32Value)2022561148U
            };

            categoryAxis1.Append(axisId3);
            categoryAxis1.Append(scaling1);
            categoryAxis1.Append(delete1);
            categoryAxis1.Append(axisPosition1);
            categoryAxis1.Append(textProperties1);
            categoryAxis1.Append(crossingAxis1);


            C.ValueAxis valueAxis1 = new C.ValueAxis();
            C.AxisId    axisId4    = new C.AxisId()
            {
                Val = (UInt32Value)2022561148U
            };

            C.Scaling     scaling2     = new C.Scaling();
            C.Orientation orientation2 = new C.Orientation()
            {
                Val = C.OrientationValues.MinMax
            };

            scaling2.Append(orientation2);
            C.Delete delete2 = new C.Delete()
            {
                Val = false
            };
            C.AxisPosition axisPosition2 = new C.AxisPosition()
            {
                Val = C.AxisPositionValues.Left
            };

            C.MajorGridlines majorGridlines1 = new C.MajorGridlines();

            C.ChartShapeProperties chartShapeProperties2 = new C.ChartShapeProperties();

            A.Outline outline2 = new A.Outline();

            A.SolidFill        solidFill2        = new A.SolidFill();
            A.RgbColorModelHex rgbColorModelHex2 = new A.RgbColorModelHex()
            {
                Val = "B7B7B7"
            };

            solidFill2.Append(rgbColorModelHex2);

            outline2.Append(solidFill2);

            chartShapeProperties2.Append(outline2);

            majorGridlines1.Append(chartShapeProperties2);
            C.NumberingFormat numberingFormat1 = new C.NumberingFormat()
            {
                FormatCode = "General", SourceLinked = true
            };
            C.TickLabelPosition tickLabelPosition1 = new C.TickLabelPosition()
            {
                Val = C.TickLabelPositionValues.NextTo
            };

            C.ChartShapeProperties chartShapeProperties3 = new C.ChartShapeProperties();

            A.Outline outline3 = new A.Outline()
            {
                Width = 47625
            };
            A.NoFill noFill1 = new A.NoFill();

            outline3.Append(noFill1);

            chartShapeProperties3.Append(outline3);

            C.TextProperties textProperties2 = new C.TextProperties();
            A.BodyProperties bodyProperties2 = new A.BodyProperties();
            A.ListStyle      listStyle2      = new A.ListStyle();

            A.Paragraph paragraph2 = new A.Paragraph();

            A.ParagraphProperties paragraphProperties2 = new A.ParagraphProperties()
            {
                Level = 0
            };
            A.DefaultRunProperties defaultRunProperties2 = new A.DefaultRunProperties()
            {
                Bold = false
            };

            paragraphProperties2.Append(defaultRunProperties2);

            paragraph2.Append(paragraphProperties2);

            textProperties2.Append(bodyProperties2);
            textProperties2.Append(listStyle2);
            textProperties2.Append(paragraph2);
            C.CrossingAxis crossingAxis2 = new C.CrossingAxis()
            {
                Val = (UInt32Value)1923141117U
            };

            valueAxis1.Append(axisId4);
            valueAxis1.Append(scaling2);
            valueAxis1.Append(delete2);
            valueAxis1.Append(axisPosition2);
            valueAxis1.Append(majorGridlines1);
            valueAxis1.Append(numberingFormat1);
            valueAxis1.Append(tickLabelPosition1);
            valueAxis1.Append(chartShapeProperties3);
            valueAxis1.Append(textProperties2);
            valueAxis1.Append(crossingAxis2);

            plotArea1.Append(layout1);
            plotArea1.Append(lineChart1);
            plotArea1.Append(categoryAxis1);
            plotArea1.Append(valueAxis1);

            C.Legend         legend1         = new C.Legend();
            C.LegendPosition legendPosition1 = new C.LegendPosition()
            {
                Val = C.LegendPositionValues.Right
            };
            C.Overlay overlay2 = new C.Overlay()
            {
                Val = false
            };

            legend1.Append(legendPosition1);
            legend1.Append(overlay2);
            C.PlotVisibleOnly plotVisibleOnly1 = new C.PlotVisibleOnly()
            {
                Val = true
            };

            chart1.Append(title1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);

            chartSpace1.Append(chart1);

            part.ChartSpace = chartSpace1;
        }
        // Generates content of chartPart1.
        private void GenerateChartPart1Content(ChartPart chartPart1)
        {
            C.ChartSpace chartSpace1 = new C.ChartSpace();
            chartSpace1.AddNamespaceDeclaration("c", "http://schemas.openxmlformats.org/drawingml/2006/chart");
            chartSpace1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");
            chartSpace1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            C.Date1904 date19041 = new C.Date1904() { Val = false };
            C.EditingLanguage editingLanguage1 = new C.EditingLanguage() { Val = "en-US" };
            C.RoundedCorners roundedCorners1 = new C.RoundedCorners() { Val = false };

            AlternateContent alternateContent1 = new AlternateContent();
            alternateContent1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");

            AlternateContentChoice alternateContentChoice1 = new AlternateContentChoice() { Requires = "c14" };
            alternateContentChoice1.AddNamespaceDeclaration("c14", "http://schemas.microsoft.com/office/drawing/2007/8/2/chart");
            C14.Style style1 = new C14.Style() { Val = 102 };

            alternateContentChoice1.Append(style1);

            AlternateContentFallback alternateContentFallback1 = new AlternateContentFallback();
            C.Style style2 = new C.Style() { Val = 2 };

            alternateContentFallback1.Append(style2);

            alternateContent1.Append(alternateContentChoice1);
            alternateContent1.Append(alternateContentFallback1);

            C.Chart chart1 = new C.Chart();
            C.AutoTitleDeleted autoTitleDeleted1 = new C.AutoTitleDeleted() { Val = true };

            C.PlotArea plotArea1 = new C.PlotArea();
            C.Layout layout1 = new C.Layout();

            C.LineChart lineChart1 = new C.LineChart();
            C.Grouping grouping1 = new C.Grouping() { Val = C.GroupingValues.Standard };
            C.VaryColors varyColors1 = new C.VaryColors() { Val = false };

            C.LineChartSeries lineChartSeries1 = new C.LineChartSeries();
            C.Index index1 = new C.Index() { Val = (UInt32Value)0U };
            C.Order order1 = new C.Order() { Val = (UInt32Value)0U };

            C.SeriesText seriesText1 = new C.SeriesText();

            C.StringReference stringReference1 = new C.StringReference();
            C.Formula formula1 = new C.Formula();
            formula1.Text = "Sheet1!$B$1";

            C.StringCache stringCache1 = new C.StringCache();
            C.PointCount pointCount1 = new C.PointCount() { Val = (UInt32Value)1U };

            C.StringPoint stringPoint1 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue1 = new C.NumericValue();
            numericValue1.Text = "Series 1";

            stringPoint1.Append(numericValue1);

            stringCache1.Append(pointCount1);
            stringCache1.Append(stringPoint1);

            stringReference1.Append(formula1);
            stringReference1.Append(stringCache1);

            seriesText1.Append(stringReference1);

            C.Marker marker1 = new C.Marker();
            C.Symbol symbol1 = new C.Symbol() { Val = C.MarkerStyleValues.None };

            marker1.Append(symbol1);

            C.CategoryAxisData categoryAxisData1 = new C.CategoryAxisData();

            C.StringReference stringReference2 = new C.StringReference();
            C.Formula formula2 = new C.Formula();
            formula2.Text = "Sheet1!$A$2:$A$5";

            C.StringCache stringCache2 = new C.StringCache();
            C.PointCount pointCount2 = new C.PointCount() { Val = (UInt32Value)4U };

            C.StringPoint stringPoint2 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue2 = new C.NumericValue();
            numericValue2.Text = "Category 1";

            stringPoint2.Append(numericValue2);

            C.StringPoint stringPoint3 = new C.StringPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue3 = new C.NumericValue();
            numericValue3.Text = "Category 2";

            stringPoint3.Append(numericValue3);

            C.StringPoint stringPoint4 = new C.StringPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue4 = new C.NumericValue();
            numericValue4.Text = "Category 3";

            stringPoint4.Append(numericValue4);

            C.StringPoint stringPoint5 = new C.StringPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue5 = new C.NumericValue();
            numericValue5.Text = "Category 4";

            stringPoint5.Append(numericValue5);

            stringCache2.Append(pointCount2);
            stringCache2.Append(stringPoint2);
            stringCache2.Append(stringPoint3);
            stringCache2.Append(stringPoint4);
            stringCache2.Append(stringPoint5);

            stringReference2.Append(formula2);
            stringReference2.Append(stringCache2);

            categoryAxisData1.Append(stringReference2);

            C.Values values1 = new C.Values();

            C.NumberReference numberReference1 = new C.NumberReference();
            C.Formula formula3 = new C.Formula();
            formula3.Text = "Sheet1!$B$2:$B$5";

            C.NumberingCache numberingCache1 = new C.NumberingCache();
            C.FormatCode formatCode1 = new C.FormatCode();
            formatCode1.Text = "General";
            C.PointCount pointCount3 = new C.PointCount() { Val = (UInt32Value)4U };

            C.NumericPoint numericPoint1 = new C.NumericPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue6 = new C.NumericValue();
            numericValue6.Text = "4.3";

            numericPoint1.Append(numericValue6);

            C.NumericPoint numericPoint2 = new C.NumericPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue7 = new C.NumericValue();
            numericValue7.Text = "2.5";

            numericPoint2.Append(numericValue7);

            C.NumericPoint numericPoint3 = new C.NumericPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue8 = new C.NumericValue();
            numericValue8.Text = "3.5";

            numericPoint3.Append(numericValue8);

            C.NumericPoint numericPoint4 = new C.NumericPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue9 = new C.NumericValue();
            numericValue9.Text = "4.5";

            numericPoint4.Append(numericValue9);

            numberingCache1.Append(formatCode1);
            numberingCache1.Append(pointCount3);
            numberingCache1.Append(numericPoint1);
            numberingCache1.Append(numericPoint2);
            numberingCache1.Append(numericPoint3);
            numberingCache1.Append(numericPoint4);

            numberReference1.Append(formula3);
            numberReference1.Append(numberingCache1);

            values1.Append(numberReference1);
            C.Smooth smooth1 = new C.Smooth() { Val = false };

            lineChartSeries1.Append(index1);
            lineChartSeries1.Append(order1);
            lineChartSeries1.Append(seriesText1);
            lineChartSeries1.Append(marker1);
            lineChartSeries1.Append(categoryAxisData1);
            lineChartSeries1.Append(values1);
            lineChartSeries1.Append(smooth1);

            C.LineChartSeries lineChartSeries2 = new C.LineChartSeries();
            C.Index index2 = new C.Index() { Val = (UInt32Value)1U };
            C.Order order2 = new C.Order() { Val = (UInt32Value)1U };

            C.SeriesText seriesText2 = new C.SeriesText();

            C.StringReference stringReference3 = new C.StringReference();
            C.Formula formula4 = new C.Formula();
            formula4.Text = "Sheet1!$C$1";

            C.StringCache stringCache3 = new C.StringCache();
            C.PointCount pointCount4 = new C.PointCount() { Val = (UInt32Value)1U };

            C.StringPoint stringPoint6 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue10 = new C.NumericValue();
            numericValue10.Text = "Series 2";

            stringPoint6.Append(numericValue10);

            stringCache3.Append(pointCount4);
            stringCache3.Append(stringPoint6);

            stringReference3.Append(formula4);
            stringReference3.Append(stringCache3);

            seriesText2.Append(stringReference3);

            C.Marker marker2 = new C.Marker();
            C.Symbol symbol2 = new C.Symbol() { Val = C.MarkerStyleValues.None };

            marker2.Append(symbol2);

            C.CategoryAxisData categoryAxisData2 = new C.CategoryAxisData();

            C.StringReference stringReference4 = new C.StringReference();
            C.Formula formula5 = new C.Formula();
            formula5.Text = "Sheet1!$A$2:$A$5";

            C.StringCache stringCache4 = new C.StringCache();
            C.PointCount pointCount5 = new C.PointCount() { Val = (UInt32Value)4U };

            C.StringPoint stringPoint7 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue11 = new C.NumericValue();
            numericValue11.Text = "Category 1";

            stringPoint7.Append(numericValue11);

            C.StringPoint stringPoint8 = new C.StringPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue12 = new C.NumericValue();
            numericValue12.Text = "Category 2";

            stringPoint8.Append(numericValue12);

            C.StringPoint stringPoint9 = new C.StringPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue13 = new C.NumericValue();
            numericValue13.Text = "Category 3";

            stringPoint9.Append(numericValue13);

            C.StringPoint stringPoint10 = new C.StringPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue14 = new C.NumericValue();
            numericValue14.Text = "Category 4";

            stringPoint10.Append(numericValue14);

            stringCache4.Append(pointCount5);
            stringCache4.Append(stringPoint7);
            stringCache4.Append(stringPoint8);
            stringCache4.Append(stringPoint9);
            stringCache4.Append(stringPoint10);

            stringReference4.Append(formula5);
            stringReference4.Append(stringCache4);

            categoryAxisData2.Append(stringReference4);

            C.Values values2 = new C.Values();

            C.NumberReference numberReference2 = new C.NumberReference();
            C.Formula formula6 = new C.Formula();
            formula6.Text = "Sheet1!$C$2:$C$5";

            C.NumberingCache numberingCache2 = new C.NumberingCache();
            C.FormatCode formatCode2 = new C.FormatCode();
            formatCode2.Text = "General";
            C.PointCount pointCount6 = new C.PointCount() { Val = (UInt32Value)4U };

            C.NumericPoint numericPoint5 = new C.NumericPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue15 = new C.NumericValue();
            numericValue15.Text = "2.4";

            numericPoint5.Append(numericValue15);

            C.NumericPoint numericPoint6 = new C.NumericPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue16 = new C.NumericValue();
            numericValue16.Text = "4.4000000000000004";

            numericPoint6.Append(numericValue16);

            C.NumericPoint numericPoint7 = new C.NumericPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue17 = new C.NumericValue();
            numericValue17.Text = "1.8";

            numericPoint7.Append(numericValue17);

            C.NumericPoint numericPoint8 = new C.NumericPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue18 = new C.NumericValue();
            numericValue18.Text = "2.8";

            numericPoint8.Append(numericValue18);

            numberingCache2.Append(formatCode2);
            numberingCache2.Append(pointCount6);
            numberingCache2.Append(numericPoint5);
            numberingCache2.Append(numericPoint6);
            numberingCache2.Append(numericPoint7);
            numberingCache2.Append(numericPoint8);

            numberReference2.Append(formula6);
            numberReference2.Append(numberingCache2);

            values2.Append(numberReference2);
            C.Smooth smooth2 = new C.Smooth() { Val = false };

            lineChartSeries2.Append(index2);
            lineChartSeries2.Append(order2);
            lineChartSeries2.Append(seriesText2);
            lineChartSeries2.Append(marker2);
            lineChartSeries2.Append(categoryAxisData2);
            lineChartSeries2.Append(values2);
            lineChartSeries2.Append(smooth2);

            C.LineChartSeries lineChartSeries3 = new C.LineChartSeries();
            C.Index index3 = new C.Index() { Val = (UInt32Value)2U };
            C.Order order3 = new C.Order() { Val = (UInt32Value)2U };

            C.SeriesText seriesText3 = new C.SeriesText();

            C.StringReference stringReference5 = new C.StringReference();
            C.Formula formula7 = new C.Formula();
            formula7.Text = "Sheet1!$D$1";

            C.StringCache stringCache5 = new C.StringCache();
            C.PointCount pointCount7 = new C.PointCount() { Val = (UInt32Value)1U };

            C.StringPoint stringPoint11 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue19 = new C.NumericValue();
            numericValue19.Text = "Series 3";

            stringPoint11.Append(numericValue19);

            stringCache5.Append(pointCount7);
            stringCache5.Append(stringPoint11);

            stringReference5.Append(formula7);
            stringReference5.Append(stringCache5);

            seriesText3.Append(stringReference5);

            C.Marker marker3 = new C.Marker();
            C.Symbol symbol3 = new C.Symbol() { Val = C.MarkerStyleValues.None };

            marker3.Append(symbol3);

            C.CategoryAxisData categoryAxisData3 = new C.CategoryAxisData();

            C.StringReference stringReference6 = new C.StringReference();
            C.Formula formula8 = new C.Formula();
            formula8.Text = "Sheet1!$A$2:$A$5";

            C.StringCache stringCache6 = new C.StringCache();
            C.PointCount pointCount8 = new C.PointCount() { Val = (UInt32Value)4U };

            C.StringPoint stringPoint12 = new C.StringPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue20 = new C.NumericValue();
            numericValue20.Text = "Category 1";

            stringPoint12.Append(numericValue20);

            C.StringPoint stringPoint13 = new C.StringPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue21 = new C.NumericValue();
            numericValue21.Text = "Category 2";

            stringPoint13.Append(numericValue21);

            C.StringPoint stringPoint14 = new C.StringPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue22 = new C.NumericValue();
            numericValue22.Text = "Category 3";

            stringPoint14.Append(numericValue22);

            C.StringPoint stringPoint15 = new C.StringPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue23 = new C.NumericValue();
            numericValue23.Text = "Category 4";

            stringPoint15.Append(numericValue23);

            stringCache6.Append(pointCount8);
            stringCache6.Append(stringPoint12);
            stringCache6.Append(stringPoint13);
            stringCache6.Append(stringPoint14);
            stringCache6.Append(stringPoint15);

            stringReference6.Append(formula8);
            stringReference6.Append(stringCache6);

            categoryAxisData3.Append(stringReference6);

            C.Values values3 = new C.Values();

            C.NumberReference numberReference3 = new C.NumberReference();
            C.Formula formula9 = new C.Formula();
            formula9.Text = "Sheet1!$D$2:$D$5";

            C.NumberingCache numberingCache3 = new C.NumberingCache();
            C.FormatCode formatCode3 = new C.FormatCode();
            formatCode3.Text = "General";
            C.PointCount pointCount9 = new C.PointCount() { Val = (UInt32Value)4U };

            C.NumericPoint numericPoint9 = new C.NumericPoint() { Index = (UInt32Value)0U };
            C.NumericValue numericValue24 = new C.NumericValue();
            numericValue24.Text = "2";

            numericPoint9.Append(numericValue24);

            C.NumericPoint numericPoint10 = new C.NumericPoint() { Index = (UInt32Value)1U };
            C.NumericValue numericValue25 = new C.NumericValue();
            numericValue25.Text = "2";

            numericPoint10.Append(numericValue25);

            C.NumericPoint numericPoint11 = new C.NumericPoint() { Index = (UInt32Value)2U };
            C.NumericValue numericValue26 = new C.NumericValue();
            numericValue26.Text = "3";

            numericPoint11.Append(numericValue26);

            C.NumericPoint numericPoint12 = new C.NumericPoint() { Index = (UInt32Value)3U };
            C.NumericValue numericValue27 = new C.NumericValue();
            numericValue27.Text = "5";

            numericPoint12.Append(numericValue27);

            numberingCache3.Append(formatCode3);
            numberingCache3.Append(pointCount9);
            numberingCache3.Append(numericPoint9);
            numberingCache3.Append(numericPoint10);
            numberingCache3.Append(numericPoint11);
            numberingCache3.Append(numericPoint12);

            numberReference3.Append(formula9);
            numberReference3.Append(numberingCache3);

            values3.Append(numberReference3);
            C.Smooth smooth3 = new C.Smooth() { Val = false };

            lineChartSeries3.Append(index3);
            lineChartSeries3.Append(order3);
            lineChartSeries3.Append(seriesText3);
            lineChartSeries3.Append(marker3);
            lineChartSeries3.Append(categoryAxisData3);
            lineChartSeries3.Append(values3);
            lineChartSeries3.Append(smooth3);

            C.DataLabels dataLabels1 = new C.DataLabels();
            C.ShowLegendKey showLegendKey1 = new C.ShowLegendKey() { Val = false };
            C.ShowValue showValue1 = new C.ShowValue() { Val = false };
            C.ShowCategoryName showCategoryName1 = new C.ShowCategoryName() { Val = false };
            C.ShowSeriesName showSeriesName1 = new C.ShowSeriesName() { Val = false };
            C.ShowPercent showPercent1 = new C.ShowPercent() { Val = false };
            C.ShowBubbleSize showBubbleSize1 = new C.ShowBubbleSize() { Val = false };

            dataLabels1.Append(showLegendKey1);
            dataLabels1.Append(showValue1);
            dataLabels1.Append(showCategoryName1);
            dataLabels1.Append(showSeriesName1);
            dataLabels1.Append(showPercent1);
            dataLabels1.Append(showBubbleSize1);
            C.ShowMarker showMarker1 = new C.ShowMarker() { Val = true };
            C.Smooth smooth4 = new C.Smooth() { Val = false };
            C.AxisId axisId1 = new C.AxisId() { Val = (UInt32Value)231952384U };
            C.AxisId axisId2 = new C.AxisId() { Val = (UInt32Value)231953920U };

            lineChart1.Append(grouping1);
            lineChart1.Append(varyColors1);
            lineChart1.Append(lineChartSeries1);
            lineChart1.Append(lineChartSeries2);
            lineChart1.Append(lineChartSeries3);
            lineChart1.Append(dataLabels1);
            lineChart1.Append(showMarker1);
            lineChart1.Append(smooth4);
            lineChart1.Append(axisId1);
            lineChart1.Append(axisId2);

            C.CategoryAxis categoryAxis1 = new C.CategoryAxis();
            C.AxisId axisId3 = new C.AxisId() { Val = (UInt32Value)231952384U };

            C.Scaling scaling1 = new C.Scaling();
            C.Orientation orientation1 = new C.Orientation() { Val = C.OrientationValues.MinMax };

            scaling1.Append(orientation1);
            C.Delete delete1 = new C.Delete() { Val = false };
            C.AxisPosition axisPosition1 = new C.AxisPosition() { Val = C.AxisPositionValues.Bottom };
            C.MajorTickMark majorTickMark1 = new C.MajorTickMark() { Val = C.TickMarkValues.Outside };
            C.MinorTickMark minorTickMark1 = new C.MinorTickMark() { Val = C.TickMarkValues.None };
            C.TickLabelPosition tickLabelPosition1 = new C.TickLabelPosition() { Val = C.TickLabelPositionValues.NextTo };
            C.CrossingAxis crossingAxis1 = new C.CrossingAxis() { Val = (UInt32Value)231953920U };
            C.Crosses crosses1 = new C.Crosses() { Val = C.CrossesValues.AutoZero };
            C.AutoLabeled autoLabeled1 = new C.AutoLabeled() { Val = true };
            C.LabelAlignment labelAlignment1 = new C.LabelAlignment() { Val = C.LabelAlignmentValues.Center };
            C.LabelOffset labelOffset1 = new C.LabelOffset() { Val = (UInt16Value)100U };
            C.NoMultiLevelLabels noMultiLevelLabels1 = new C.NoMultiLevelLabels() { Val = false };

            categoryAxis1.Append(axisId3);
            categoryAxis1.Append(scaling1);
            categoryAxis1.Append(delete1);
            categoryAxis1.Append(axisPosition1);
            categoryAxis1.Append(majorTickMark1);
            categoryAxis1.Append(minorTickMark1);
            categoryAxis1.Append(tickLabelPosition1);
            categoryAxis1.Append(crossingAxis1);
            categoryAxis1.Append(crosses1);
            categoryAxis1.Append(autoLabeled1);
            categoryAxis1.Append(labelAlignment1);
            categoryAxis1.Append(labelOffset1);
            categoryAxis1.Append(noMultiLevelLabels1);

            C.ValueAxis valueAxis1 = new C.ValueAxis();
            C.AxisId axisId4 = new C.AxisId() { Val = (UInt32Value)231953920U };

            C.Scaling scaling2 = new C.Scaling();
            C.Orientation orientation2 = new C.Orientation() { Val = C.OrientationValues.MinMax };

            scaling2.Append(orientation2);
            C.Delete delete2 = new C.Delete() { Val = false };
            C.AxisPosition axisPosition2 = new C.AxisPosition() { Val = C.AxisPositionValues.Left };
            C.MajorGridlines majorGridlines1 = new C.MajorGridlines();
            C.NumberingFormat numberingFormat1 = new C.NumberingFormat() { FormatCode = "General", SourceLinked = true };
            C.MajorTickMark majorTickMark2 = new C.MajorTickMark() { Val = C.TickMarkValues.Outside };
            C.MinorTickMark minorTickMark2 = new C.MinorTickMark() { Val = C.TickMarkValues.None };
            C.TickLabelPosition tickLabelPosition2 = new C.TickLabelPosition() { Val = C.TickLabelPositionValues.NextTo };
            C.CrossingAxis crossingAxis2 = new C.CrossingAxis() { Val = (UInt32Value)231952384U };
            C.Crosses crosses2 = new C.Crosses() { Val = C.CrossesValues.AutoZero };
            C.CrossBetween crossBetween1 = new C.CrossBetween() { Val = C.CrossBetweenValues.Between };

            valueAxis1.Append(axisId4);
            valueAxis1.Append(scaling2);
            valueAxis1.Append(delete2);
            valueAxis1.Append(axisPosition2);
            valueAxis1.Append(majorGridlines1);
            valueAxis1.Append(numberingFormat1);
            valueAxis1.Append(majorTickMark2);
            valueAxis1.Append(minorTickMark2);
            valueAxis1.Append(tickLabelPosition2);
            valueAxis1.Append(crossingAxis2);
            valueAxis1.Append(crosses2);
            valueAxis1.Append(crossBetween1);

            plotArea1.Append(layout1);
            plotArea1.Append(lineChart1);
            plotArea1.Append(categoryAxis1);
            plotArea1.Append(valueAxis1);

            C.Legend legend1 = new C.Legend();
            C.LegendPosition legendPosition1 = new C.LegendPosition() { Val = C.LegendPositionValues.Right };
            C.Overlay overlay1 = new C.Overlay() { Val = false };

            legend1.Append(legendPosition1);
            legend1.Append(overlay1);
            C.PlotVisibleOnly plotVisibleOnly1 = new C.PlotVisibleOnly() { Val = true };
            C.DisplayBlanksAs displayBlanksAs1 = new C.DisplayBlanksAs() { Val = C.DisplayBlanksAsValues.Gap };
            C.ShowDataLabelsOverMaximum showDataLabelsOverMaximum1 = new C.ShowDataLabelsOverMaximum() { Val = false };

            chart1.Append(autoTitleDeleted1);
            chart1.Append(plotArea1);
            chart1.Append(legend1);
            chart1.Append(plotVisibleOnly1);
            chart1.Append(displayBlanksAs1);
            chart1.Append(showDataLabelsOverMaximum1);

            C.ExternalData externalData1 = new C.ExternalData() { Id = "rId1" };
            C.AutoUpdate autoUpdate1 = new C.AutoUpdate() { Val = false };

            externalData1.Append(autoUpdate1);

            chartSpace1.Append(date19041);
            chartSpace1.Append(editingLanguage1);
            chartSpace1.Append(roundedCorners1);
            chartSpace1.Append(alternateContent1);
            chartSpace1.Append(chart1);
            chartSpace1.Append(externalData1);

            chartPart1.ChartSpace = chartSpace1;
        }
Example #5
0
        internal C.PlotArea ToPlotArea()
        {
            C.PlotArea pa = new C.PlotArea();
            pa.Append(this.Layout.ToLayout());

            int iChartType;
            int i;

            // TODO: the rendering order is sort of listed in the following.
            // But apparently if you plot data series for doughnut first before bar-of-pie
            // it's different than if you plot bar-of-pie then doughnut.
            // Find out the "correct" order next version I suppose...

            // Excel 2010 apparently sets this by default for any chart...
            SLGroupDataLabelOptions gdlo = new SLGroupDataLabelOptions(this.ShapeProperties.listThemeColors);
            gdlo.ShowLegendKey = false;
            gdlo.ShowValue = false;
            gdlo.ShowCategoryName = false;
            gdlo.ShowSeriesName = false;
            gdlo.ShowPercentage = false;
            gdlo.ShowBubbleSize = false;

            #region Doughnut
            iChartType = (int)SLDataSeriesChartType.DoughnutChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.DoughnutChart dc = new C.DoughnutChart();
                dc.VaryColors = new C.VaryColors() { Val = this.UsedChartOptions[iChartType].VaryColors ?? true };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        dc.Append(this.DataSeries[i].ToPieChartSeries());
                    }
                }

                dc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                dc.Append(new C.FirstSliceAngle() { Val = this.UsedChartOptions[iChartType].FirstSliceAngle });
                dc.Append(new C.HoleSize() { Val = this.UsedChartOptions[iChartType].HoleSize });
                
                pa.Append(dc);
            }
            #endregion

            #region Bar-of-pie
            iChartType = (int)SLDataSeriesChartType.OfPieChartBar;
            if (this.UsedChartTypes[iChartType])
            {
                C.OfPieChart opc = new C.OfPieChart();
                opc.OfPieType = new C.OfPieType() { Val = C.OfPieValues.Bar };
                opc.VaryColors = new C.VaryColors() { Val = this.UsedChartOptions[iChartType].VaryColors ?? true };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        opc.Append(this.DataSeries[i].ToPieChartSeries());
                    }
                }

                opc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                opc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });
                
                if (this.UsedChartOptions[iChartType].HasSplit)
                {
                    opc.Append(new C.SplitType() { Val = this.UsedChartOptions[iChartType].SplitType });
                    if (this.UsedChartOptions[iChartType].SplitType != C.SplitValues.Custom)
                    {
                        opc.Append(new C.SplitPosition() { Val = this.UsedChartOptions[iChartType].SplitPosition });
                    }
                    else
                    {
                        C.CustomSplit custsplit = new C.CustomSplit();
                        foreach (int iPiePoint in this.UsedChartOptions[iChartType].SecondPiePoints)
                        {
                            custsplit.Append(new C.SecondPiePoint() { Val = (uint)iPiePoint });
                        }
                        opc.Append(custsplit);
                    }
                }

                opc.Append(new C.SecondPieSize() { Val = this.UsedChartOptions[iChartType].SecondPieSize });

                if (this.UsedChartOptions[iChartType].SeriesLinesShapeProperties.HasShapeProperties)
                {
                    opc.Append(new C.SeriesLines()
                    {
                        ChartShapeProperties = this.UsedChartOptions[iChartType].SeriesLinesShapeProperties.ToChartShapeProperties()
                    });
                }
                else
                {
                    opc.Append(new C.SeriesLines());
                }

                pa.Append(opc);
            }
            #endregion

            #region Pie-of-pie
            iChartType = (int)SLDataSeriesChartType.OfPieChartPie;
            if (this.UsedChartTypes[iChartType])
            {
                C.OfPieChart opc = new C.OfPieChart();
                opc.OfPieType = new C.OfPieType() { Val = C.OfPieValues.Pie };
                opc.VaryColors = new C.VaryColors() { Val = this.UsedChartOptions[iChartType].VaryColors ?? true };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        opc.Append(this.DataSeries[i].ToPieChartSeries());
                    }
                }

                opc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                opc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].HasSplit)
                {
                    opc.Append(new C.SplitType() { Val = this.UsedChartOptions[iChartType].SplitType });
                    if (this.UsedChartOptions[iChartType].SplitType != C.SplitValues.Custom)
                    {
                        opc.Append(new C.SplitPosition() { Val = this.UsedChartOptions[iChartType].SplitPosition });
                    }
                    else
                    {
                        C.CustomSplit custsplit = new C.CustomSplit();
                        foreach (int iPiePoint in this.UsedChartOptions[iChartType].SecondPiePoints)
                        {
                            custsplit.Append(new C.SecondPiePoint() { Val = (uint)iPiePoint });
                        }
                        opc.Append(custsplit);
                    }
                }

                opc.Append(new C.SecondPieSize() { Val = this.UsedChartOptions[iChartType].SecondPieSize });

                if (this.UsedChartOptions[iChartType].SeriesLinesShapeProperties.HasShapeProperties)
                {
                    opc.Append(new C.SeriesLines()
                    {
                        ChartShapeProperties = this.UsedChartOptions[iChartType].SeriesLinesShapeProperties.ToChartShapeProperties()
                    });
                }
                else
                {
                    opc.Append(new C.SeriesLines());
                }

                pa.Append(opc);
            }
            #endregion

            #region Pie
            iChartType = (int)SLDataSeriesChartType.PieChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.PieChart pc = new C.PieChart();
                pc.VaryColors = new C.VaryColors() { Val = this.UsedChartOptions[iChartType].VaryColors ?? true };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        pc.Append(this.DataSeries[i].ToPieChartSeries());
                    }
                }

                pc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                pc.Append(new C.FirstSliceAngle() { Val = this.UsedChartOptions[iChartType].FirstSliceAngle });

                pa.Append(pc);
            }
            #endregion

            #region Radar primary
            iChartType = (int)SLDataSeriesChartType.RadarChartPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.RadarChart rc = new C.RadarChart();
                rc.RadarStyle = new C.RadarStyle() { Val = this.UsedChartOptions[iChartType].RadarStyle };
                rc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        rc.Append(this.DataSeries[i].ToRadarChartSeries());
                    }
                }

                rc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                rc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                rc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(rc);
            }
            #endregion

            #region Radar secondary
            iChartType = (int)SLDataSeriesChartType.RadarChartSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.RadarChart rc = new C.RadarChart();
                rc.RadarStyle = new C.RadarStyle() { Val = this.UsedChartOptions[iChartType].RadarStyle };
                rc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        rc.Append(this.DataSeries[i].ToRadarChartSeries());
                    }
                }

                rc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                rc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                rc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(rc);
            }
            #endregion

            #region Area primary
            iChartType = (int)SLDataSeriesChartType.AreaChartPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.AreaChart ac = new C.AreaChart();
                ac.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                ac.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(this.DataSeries[i].ToAreaChartSeries());
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                ac.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                ac.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(ac);
            }
            #endregion

            #region Area secondary
            iChartType = (int)SLDataSeriesChartType.AreaChartSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.AreaChart ac = new C.AreaChart();
                ac.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                ac.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(this.DataSeries[i].ToAreaChartSeries());
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                ac.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                ac.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(ac);
            }
            #endregion

            #region Column primary
            iChartType = (int)SLDataSeriesChartType.BarChartColumnPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.BarChart bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection() { Val = C.BarDirectionValues.Column };
                bc.BarGrouping = new C.BarGrouping() { Val = this.UsedChartOptions[iChartType].BarGrouping };
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBarChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap() { Val = this.UsedChartOptions[iChartType].Overlap });
                }

                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(bc);
            }
            #endregion

            #region Column secondary
            iChartType = (int)SLDataSeriesChartType.BarChartColumnSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.BarChart bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection() { Val = C.BarDirectionValues.Column };
                bc.BarGrouping = new C.BarGrouping() { Val = this.UsedChartOptions[iChartType].BarGrouping };
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBarChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap() { Val = this.UsedChartOptions[iChartType].Overlap });
                }

                bc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(bc);
            }
            #endregion

            #region Bar primary
            iChartType = (int)SLDataSeriesChartType.BarChartBarPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.BarChart bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection() { Val = C.BarDirectionValues.Bar };
                bc.BarGrouping = new C.BarGrouping() { Val = this.UsedChartOptions[iChartType].BarGrouping };
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBarChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap() { Val = this.UsedChartOptions[iChartType].Overlap });
                }

                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(bc);
            }
            #endregion

            #region Bar secondary
            iChartType = (int)SLDataSeriesChartType.BarChartBarSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.BarChart bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection() { Val = C.BarDirectionValues.Bar };
                bc.BarGrouping = new C.BarGrouping() { Val = this.UsedChartOptions[iChartType].BarGrouping };
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBarChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap() { Val = this.UsedChartOptions[iChartType].Overlap });
                }

                bc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(bc);
            }
            #endregion

            #region Scatter primary
            iChartType = (int)SLDataSeriesChartType.ScatterChartPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.ScatterChart sc = new C.ScatterChart();
                sc.ScatterStyle = new C.ScatterStyle() { Val = this.UsedChartOptions[iChartType].ScatterStyle };
                sc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(this.DataSeries[i].ToScatterChartSeries());
                    }
                }

                sc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(sc);
            }
            #endregion

            #region Scatter secondary
            iChartType = (int)SLDataSeriesChartType.ScatterChartSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.ScatterChart sc = new C.ScatterChart();
                sc.ScatterStyle = new C.ScatterStyle() { Val = this.UsedChartOptions[iChartType].ScatterStyle };
                sc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(this.DataSeries[i].ToScatterChartSeries());
                    }
                }

                sc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                sc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                sc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(sc);
            }
            #endregion

            #region Line primary
            iChartType = (int)SLDataSeriesChartType.LineChartPrimary;
            if (this.UsedChartTypes[iChartType])
            {
                C.LineChart lc = new C.LineChart();
                lc.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                lc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(this.DataSeries[i].ToLineChartSeries());
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                lc.Append(new C.ShowMarker() { Val = this.UsedChartOptions[iChartType].ShowMarker });
                lc.Append(new C.Smooth() { Val = this.UsedChartOptions[iChartType].Smooth });

                lc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                lc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(lc);
            }
            #endregion

            #region Line secondary
            iChartType = (int)SLDataSeriesChartType.LineChartSecondary;
            if (this.UsedChartTypes[iChartType])
            {
                C.LineChart lc = new C.LineChart();
                lc.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                lc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(this.DataSeries[i].ToLineChartSeries());
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                lc.Append(new C.ShowMarker() { Val = this.UsedChartOptions[iChartType].ShowMarker });
                lc.Append(new C.Smooth() { Val = this.UsedChartOptions[iChartType].Smooth });

                lc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis1 });
                lc.Append(new C.AxisId() { Val = SLConstants.SecondaryAxis2 });

                pa.Append(lc);
            }
            #endregion

            #region Area3D
            iChartType = (int)SLDataSeriesChartType.Area3DChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.Area3DChart ac = new C.Area3DChart();
                ac.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                ac.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(this.DataSeries[i].ToAreaChartSeries());
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                if (this.UsedChartOptions[iChartType].GapDepth != 150)
                {
                    ac.Append(new C.GapDepth() { Val = this.UsedChartOptions[iChartType].GapDepth });
                }

                ac.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                ac.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });
                ac.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis3 });

                pa.Append(ac);
            }
            #endregion

            #region Bar3D
            iChartType = (int)SLDataSeriesChartType.Bar3DChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.Bar3DChart bc = new C.Bar3DChart();
                bc.BarDirection = new C.BarDirection() { Val = this.UsedChartOptions[iChartType].BarDirection };
                bc.BarGrouping = new C.BarGrouping() { Val = this.UsedChartOptions[iChartType].BarGrouping };
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBarChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth() { Val = this.UsedChartOptions[iChartType].GapWidth });

                if (this.UsedChartOptions[iChartType].GapDepth != 150)
                {
                    bc.Append(new C.GapDepth() { Val = this.UsedChartOptions[iChartType].GapDepth });
                }

                bc.Append(new C.Shape() { Val = this.UsedChartOptions[iChartType].Shape });

                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });
                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis3 });

                pa.Append(bc);
            }
            #endregion

            #region Bubble
            iChartType = (int)SLDataSeriesChartType.BubbleChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.BubbleChart bc = new C.BubbleChart();
                bc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(this.DataSeries[i].ToBubbleChartSeries());
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                if (!this.UsedChartOptions[iChartType].Bubble3D)
                {
                    bc.Append(new C.Bubble3D() { Val = this.UsedChartOptions[iChartType].Bubble3D });
                }

                if (this.UsedChartOptions[iChartType].BubbleScale != 100)
                {
                    bc.Append(new C.BubbleScale() { Val = this.UsedChartOptions[iChartType].BubbleScale });
                }

                if (!this.UsedChartOptions[iChartType].ShowNegativeBubbles)
                {
                    bc.Append(new C.ShowNegativeBubbles() { Val = this.UsedChartOptions[iChartType].ShowNegativeBubbles });
                }

                if (this.UsedChartOptions[iChartType].SizeRepresents != C.SizeRepresentsValues.Area)
                {
                    bc.Append(new C.SizeRepresents() { Val = this.UsedChartOptions[iChartType].SizeRepresents });
                }

                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                bc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });

                pa.Append(bc);
            }
            #endregion

            #region Line3D
            iChartType = (int)SLDataSeriesChartType.Line3DChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.Line3DChart lc = new C.Line3DChart();
                lc.Grouping = new C.Grouping() { Val = this.UsedChartOptions[iChartType].Grouping };
                lc.VaryColors = new C.VaryColors() { Val = false };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(this.DataSeries[i].ToLineChartSeries());
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                if (this.UsedChartOptions[iChartType].GapDepth != 150)
                {
                    lc.Append(new C.GapDepth() { Val = this.UsedChartOptions[iChartType].GapDepth });
                }

                lc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                lc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });
                lc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis3 });

                pa.Append(lc);
            }
            #endregion

            #region Pie3D
            iChartType = (int)SLDataSeriesChartType.Pie3DChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.Pie3DChart pc = new C.Pie3DChart();
                pc.VaryColors = new C.VaryColors() { Val = this.UsedChartOptions[iChartType].VaryColors ?? true };

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        pc.Append(this.DataSeries[i].ToPieChartSeries());
                    }
                }

                pc.Append(gdlo.ToDataLabels(new Dictionary<int, SLDataLabelOptions>(), false));

                pa.Append(pc);
            }
            #endregion

            #region Surface
            iChartType = (int)SLDataSeriesChartType.SurfaceChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.SurfaceChart sc = new C.SurfaceChart();
                if (this.UsedChartOptions[iChartType].bWireframe != null)
                {
                    sc.Wireframe = new C.Wireframe() { Val = this.UsedChartOptions[iChartType].Wireframe };
                }

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(this.DataSeries[i].ToSurfaceChartSeries());
                    }
                }

                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });
                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis3 });

                pa.Append(sc);
            }
            #endregion

            #region Surface3D
            iChartType = (int)SLDataSeriesChartType.Surface3DChart;
            if (this.UsedChartTypes[iChartType])
            {
                C.Surface3DChart sc = new C.Surface3DChart();
                if (this.UsedChartOptions[iChartType].bWireframe != null)
                {
                    sc.Wireframe = new C.Wireframe() { Val = this.UsedChartOptions[iChartType].Wireframe };
                }

                for (i = 0; i < this.DataSeries.Count; ++i)
                {
                    if ((int)this.DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(this.DataSeries[i].ToSurfaceChartSeries());
                    }
                }

                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis1 });
                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis2 });
                sc.Append(new C.AxisId() { Val = SLConstants.PrimaryAxis3 });

                pa.Append(sc);
            }
            #endregion

            if (this.HasPrimaryAxes)
            {
                this.PrimaryTextAxis.IsCrosses = this.PrimaryValueAxis.OtherAxisIsCrosses;
                this.PrimaryTextAxis.Crosses = this.PrimaryValueAxis.OtherAxisCrosses;
                this.PrimaryTextAxis.CrossesAt = this.PrimaryValueAxis.OtherAxisCrossesAt;

                this.PrimaryTextAxis.OtherAxisIsInReverseOrder = this.PrimaryValueAxis.InReverseOrder;

                if (this.PrimaryValueAxis.OtherAxisIsCrosses != null
                    && this.PrimaryValueAxis.OtherAxisIsCrosses.Value
                    && this.PrimaryValueAxis.OtherAxisCrosses == C.CrossesValues.Maximum)
                {
                    this.PrimaryTextAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    this.PrimaryTextAxis.OtherAxisCrossedAtMaximum = false;
                }

                this.PrimaryValueAxis.IsCrosses = this.PrimaryTextAxis.OtherAxisIsCrosses;
                this.PrimaryValueAxis.Crosses = this.PrimaryTextAxis.OtherAxisCrosses;
                this.PrimaryValueAxis.CrossesAt = this.PrimaryTextAxis.OtherAxisCrossesAt;

                // value axis takes on text axis CrossBetween.
                this.PrimaryValueAxis.CrossBetween = this.PrimaryTextAxis.CrossBetween;

                this.PrimaryValueAxis.OtherAxisIsInReverseOrder = this.PrimaryTextAxis.InReverseOrder;

                if (this.PrimaryTextAxis.OtherAxisIsCrosses != null
                    && this.PrimaryTextAxis.OtherAxisIsCrosses.Value
                    && this.PrimaryTextAxis.OtherAxisCrosses == C.CrossesValues.Maximum)
                {
                    this.PrimaryValueAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    this.PrimaryValueAxis.OtherAxisCrossedAtMaximum = false;
                }

                switch (this.PrimaryTextAxis.AxisType)
                {
                    case SLAxisType.Category:
                        pa.Append(this.PrimaryTextAxis.ToCategoryAxis());
                        break;
                    case SLAxisType.Date:
                        pa.Append(this.PrimaryTextAxis.ToDateAxis());
                        break;
                    case SLAxisType.Value:
                        pa.Append(this.PrimaryTextAxis.ToValueAxis());
                        break;
                }
                pa.Append(this.PrimaryValueAxis.ToValueAxis());
            }

            if (this.HasDepthAxis)
            {
                pa.Append(this.DepthAxis.ToSeriesAxis());
            }

            if (this.HasSecondaryAxes)
            {
                this.SecondaryTextAxis.IsCrosses = this.SecondaryValueAxis.OtherAxisIsCrosses;
                this.SecondaryTextAxis.Crosses = this.SecondaryValueAxis.OtherAxisCrosses;
                this.SecondaryTextAxis.CrossesAt = this.SecondaryValueAxis.OtherAxisCrossesAt;

                this.SecondaryTextAxis.OtherAxisIsInReverseOrder = this.SecondaryValueAxis.InReverseOrder;

                if (this.SecondaryValueAxis.OtherAxisIsCrosses != null
                    && this.SecondaryValueAxis.OtherAxisIsCrosses.Value
                    && this.SecondaryValueAxis.OtherAxisCrosses == C.CrossesValues.Maximum)
                {
                    this.SecondaryTextAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    this.SecondaryTextAxis.OtherAxisCrossedAtMaximum = false;
                }

                this.SecondaryValueAxis.IsCrosses = this.SecondaryTextAxis.OtherAxisIsCrosses;
                this.SecondaryValueAxis.Crosses = this.SecondaryTextAxis.OtherAxisCrosses;
                this.SecondaryValueAxis.CrossesAt = this.SecondaryTextAxis.OtherAxisCrossesAt;

                // value axis takes on text axis CrossBetween.
                this.SecondaryValueAxis.CrossBetween = this.SecondaryTextAxis.CrossBetween;

                this.SecondaryValueAxis.OtherAxisIsInReverseOrder = this.SecondaryTextAxis.InReverseOrder;

                if (this.SecondaryTextAxis.OtherAxisIsCrosses != null
                    && this.SecondaryTextAxis.OtherAxisIsCrosses.Value
                    && this.SecondaryTextAxis.OtherAxisCrosses == C.CrossesValues.Maximum)
                {
                    this.SecondaryValueAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    this.SecondaryValueAxis.OtherAxisCrossedAtMaximum = false;
                }

                // the order of axes is:
                // 1) primary category/date/value axis
                // 2) primary value axis
                // 3) secondary value axis
                // 4) secondary category/date/value axis
                pa.Append(this.SecondaryValueAxis.ToValueAxis());
                switch (this.SecondaryTextAxis.AxisType)
                {
                    case SLAxisType.Category:
                        pa.Append(this.SecondaryTextAxis.ToCategoryAxis());
                        break;
                    case SLAxisType.Date:
                        pa.Append(this.SecondaryTextAxis.ToDateAxis());
                        break;
                    case SLAxisType.Value:
                        pa.Append(this.SecondaryTextAxis.ToValueAxis());
                        break;
                }
            }

            if (this.ShowDataTable) pa.Append(this.DataTable.ToDataTable());

            if (this.ShapeProperties.HasShapeProperties) pa.Append(this.ShapeProperties.ToChartShapeProperties());

            return pa;
        }
        internal C.PlotArea ToPlotArea(bool IsStylish = false)
        {
            var pa = new C.PlotArea();

            pa.Append(Layout.ToLayout());

            int iChartType;
            int i;

            // TODO: the rendering order is sort of listed in the following.
            // But apparently if you plot data series for doughnut first before bar-of-pie
            // it's different than if you plot bar-of-pie then doughnut.
            // Find out the "correct" order next version I suppose...

            // Excel 2010 apparently sets this by default for any chart...
            var gdlo = new SLGroupDataLabelOptions(ShapeProperties.listThemeColors);

            gdlo.ShowLegendKey    = false;
            gdlo.ShowValue        = false;
            gdlo.ShowCategoryName = false;
            gdlo.ShowSeriesName   = false;
            gdlo.ShowPercentage   = false;
            gdlo.ShowBubbleSize   = false;

            #region Doughnut

            iChartType = (int)SLDataSeriesChartType.DoughnutChart;
            if (UsedChartTypes[iChartType])
            {
                var dc = new C.DoughnutChart();
                dc.VaryColors = new C.VaryColors {
                    Val = UsedChartOptions[iChartType].VaryColors ?? true
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        dc.Append(DataSeries[i].ToPieChartSeries(IsStylish));
                    }
                }

                dc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                dc.Append(new C.FirstSliceAngle {
                    Val = UsedChartOptions[iChartType].FirstSliceAngle
                });
                dc.Append(new C.HoleSize {
                    Val = UsedChartOptions[iChartType].HoleSize
                });

                pa.Append(dc);
            }

            #endregion

            #region Bar-of-pie

            iChartType = (int)SLDataSeriesChartType.OfPieChartBar;
            if (UsedChartTypes[iChartType])
            {
                var opc = new C.OfPieChart();
                opc.OfPieType = new C.OfPieType {
                    Val = C.OfPieValues.Bar
                };
                opc.VaryColors = new C.VaryColors {
                    Val = UsedChartOptions[iChartType].VaryColors ?? true
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        opc.Append(DataSeries[i].ToPieChartSeries(IsStylish));
                    }
                }

                opc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                opc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].HasSplit)
                {
                    opc.Append(new C.SplitType {
                        Val = UsedChartOptions[iChartType].SplitType
                    });
                    if (UsedChartOptions[iChartType].SplitType != C.SplitValues.Custom)
                    {
                        opc.Append(new C.SplitPosition {
                            Val = UsedChartOptions[iChartType].SplitPosition
                        });
                    }
                    else
                    {
                        var custsplit = new C.CustomSplit();
                        foreach (var iPiePoint in UsedChartOptions[iChartType].SecondPiePoints)
                        {
                            custsplit.Append(new C.SecondPiePoint {
                                Val = (uint)iPiePoint
                            });
                        }
                        opc.Append(custsplit);
                    }
                }

                opc.Append(new C.SecondPieSize {
                    Val = UsedChartOptions[iChartType].SecondPieSize
                });

                if (UsedChartOptions[iChartType].SeriesLinesShapeProperties.HasShapeProperties)
                {
                    opc.Append(new C.SeriesLines
                    {
                        ChartShapeProperties =
                            UsedChartOptions[iChartType].SeriesLinesShapeProperties.ToChartShapeProperties()
                    });
                }
                else
                {
                    opc.Append(new C.SeriesLines());
                }

                pa.Append(opc);
            }

            #endregion

            #region Pie-of-pie

            iChartType = (int)SLDataSeriesChartType.OfPieChartPie;
            if (UsedChartTypes[iChartType])
            {
                var opc = new C.OfPieChart();
                opc.OfPieType = new C.OfPieType {
                    Val = C.OfPieValues.Pie
                };
                opc.VaryColors = new C.VaryColors {
                    Val = UsedChartOptions[iChartType].VaryColors ?? true
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        opc.Append(DataSeries[i].ToPieChartSeries(IsStylish));
                    }
                }

                opc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                opc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].HasSplit)
                {
                    opc.Append(new C.SplitType {
                        Val = UsedChartOptions[iChartType].SplitType
                    });
                    if (UsedChartOptions[iChartType].SplitType != C.SplitValues.Custom)
                    {
                        opc.Append(new C.SplitPosition {
                            Val = UsedChartOptions[iChartType].SplitPosition
                        });
                    }
                    else
                    {
                        var custsplit = new C.CustomSplit();
                        foreach (var iPiePoint in UsedChartOptions[iChartType].SecondPiePoints)
                        {
                            custsplit.Append(new C.SecondPiePoint {
                                Val = (uint)iPiePoint
                            });
                        }
                        opc.Append(custsplit);
                    }
                }

                opc.Append(new C.SecondPieSize {
                    Val = UsedChartOptions[iChartType].SecondPieSize
                });

                if (UsedChartOptions[iChartType].SeriesLinesShapeProperties.HasShapeProperties)
                {
                    opc.Append(new C.SeriesLines
                    {
                        ChartShapeProperties =
                            UsedChartOptions[iChartType].SeriesLinesShapeProperties.ToChartShapeProperties()
                    });
                }
                else
                {
                    opc.Append(new C.SeriesLines());
                }

                pa.Append(opc);
            }

            #endregion

            #region Pie

            iChartType = (int)SLDataSeriesChartType.PieChart;
            if (UsedChartTypes[iChartType])
            {
                var pc = new C.PieChart();
                pc.VaryColors = new C.VaryColors {
                    Val = UsedChartOptions[iChartType].VaryColors ?? true
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        pc.Append(DataSeries[i].ToPieChartSeries(IsStylish));
                    }
                }

                pc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                pc.Append(new C.FirstSliceAngle {
                    Val = UsedChartOptions[iChartType].FirstSliceAngle
                });

                pa.Append(pc);
            }

            #endregion

            #region Radar primary

            iChartType = (int)SLDataSeriesChartType.RadarChartPrimary;
            if (UsedChartTypes[iChartType])
            {
                var rc = new C.RadarChart();
                rc.RadarStyle = new C.RadarStyle {
                    Val = UsedChartOptions[iChartType].RadarStyle
                };
                rc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        rc.Append(DataSeries[i].ToRadarChartSeries(IsStylish));
                    }
                }

                rc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                rc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                rc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(rc);
            }

            #endregion

            #region Radar secondary

            iChartType = (int)SLDataSeriesChartType.RadarChartSecondary;
            if (UsedChartTypes[iChartType])
            {
                var rc = new C.RadarChart();
                rc.RadarStyle = new C.RadarStyle {
                    Val = UsedChartOptions[iChartType].RadarStyle
                };
                rc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        rc.Append(DataSeries[i].ToRadarChartSeries(IsStylish));
                    }
                }

                rc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                rc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                rc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(rc);
            }

            #endregion

            #region Area primary

            iChartType = (int)SLDataSeriesChartType.AreaChartPrimary;
            if (UsedChartTypes[iChartType])
            {
                var ac = new C.AreaChart();
                ac.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                ac.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(DataSeries[i].ToAreaChartSeries(IsStylish));
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    ac.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                ac.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                ac.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(ac);
            }

            #endregion

            #region Area secondary

            iChartType = (int)SLDataSeriesChartType.AreaChartSecondary;
            if (UsedChartTypes[iChartType])
            {
                var ac = new C.AreaChart();
                ac.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                ac.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(DataSeries[i].ToAreaChartSeries(IsStylish));
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    ac.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                ac.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                ac.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(ac);
            }

            #endregion

            #region Column primary

            iChartType = (int)SLDataSeriesChartType.BarChartColumnPrimary;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection {
                    Val = C.BarDirectionValues.Column
                };
                bc.BarGrouping = new C.BarGrouping {
                    Val = UsedChartOptions[iChartType].BarGrouping
                };
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBarChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap {
                        Val = UsedChartOptions[iChartType].Overlap
                    });
                }

                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(bc);
            }

            #endregion

            #region Column secondary

            iChartType = (int)SLDataSeriesChartType.BarChartColumnSecondary;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection {
                    Val = C.BarDirectionValues.Column
                };
                bc.BarGrouping = new C.BarGrouping {
                    Val = UsedChartOptions[iChartType].BarGrouping
                };
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBarChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap {
                        Val = UsedChartOptions[iChartType].Overlap
                    });
                }

                bc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(bc);
            }

            #endregion

            #region Bar primary

            iChartType = (int)SLDataSeriesChartType.BarChartBarPrimary;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection {
                    Val = C.BarDirectionValues.Bar
                };
                bc.BarGrouping = new C.BarGrouping {
                    Val = UsedChartOptions[iChartType].BarGrouping
                };
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBarChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap {
                        Val = UsedChartOptions[iChartType].Overlap
                    });
                }

                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(bc);
            }

            #endregion

            #region Bar secondary

            iChartType = (int)SLDataSeriesChartType.BarChartBarSecondary;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.BarChart();
                bc.BarDirection = new C.BarDirection {
                    Val = C.BarDirectionValues.Bar
                };
                bc.BarGrouping = new C.BarGrouping {
                    Val = UsedChartOptions[iChartType].BarGrouping
                };
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBarChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].Overlap != 0)
                {
                    bc.Append(new C.Overlap {
                        Val = UsedChartOptions[iChartType].Overlap
                    });
                }

                bc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(bc);
            }

            #endregion

            #region Scatter primary

            iChartType = (int)SLDataSeriesChartType.ScatterChartPrimary;
            if (UsedChartTypes[iChartType])
            {
                var sc = new C.ScatterChart();
                sc.ScatterStyle = new C.ScatterStyle {
                    Val = UsedChartOptions[iChartType].ScatterStyle
                };
                sc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(DataSeries[i].ToScatterChartSeries(IsStylish));
                    }
                }

                sc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(sc);
            }

            #endregion

            #region Scatter secondary

            iChartType = (int)SLDataSeriesChartType.ScatterChartSecondary;
            if (UsedChartTypes[iChartType])
            {
                var sc = new C.ScatterChart();
                sc.ScatterStyle = new C.ScatterStyle {
                    Val = UsedChartOptions[iChartType].ScatterStyle
                };
                sc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(DataSeries[i].ToScatterChartSeries(IsStylish));
                    }
                }

                sc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                sc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(sc);
            }

            #endregion

            #region Line primary

            iChartType = (int)SLDataSeriesChartType.LineChartPrimary;
            if (UsedChartTypes[iChartType])
            {
                var lc = new C.LineChart();
                lc.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                lc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(DataSeries[i].ToLineChartSeries(IsStylish));
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    lc.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                lc.Append(new C.ShowMarker {
                    Val = UsedChartOptions[iChartType].ShowMarker
                });
                lc.Append(new C.Smooth {
                    Val = UsedChartOptions[iChartType].Smooth
                });

                lc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                lc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(lc);
            }

            #endregion

            #region Line secondary

            iChartType = (int)SLDataSeriesChartType.LineChartSecondary;
            if (UsedChartTypes[iChartType])
            {
                var lc = new C.LineChart();
                lc.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                lc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(DataSeries[i].ToLineChartSeries(IsStylish));
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    lc.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                lc.Append(new C.ShowMarker {
                    Val = UsedChartOptions[iChartType].ShowMarker
                });
                lc.Append(new C.Smooth {
                    Val = UsedChartOptions[iChartType].Smooth
                });

                lc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis1
                });
                lc.Append(new C.AxisId {
                    Val = SLConstants.SecondaryAxis2
                });

                pa.Append(lc);
            }

            #endregion

            #region Area3D

            iChartType = (int)SLDataSeriesChartType.Area3DChart;
            if (UsedChartTypes[iChartType])
            {
                var ac = new C.Area3DChart();
                ac.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                ac.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        ac.Append(DataSeries[i].ToAreaChartSeries(IsStylish));
                    }
                }

                ac.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].GapDepth != 150)
                {
                    ac.Append(new C.GapDepth {
                        Val = UsedChartOptions[iChartType].GapDepth
                    });
                }

                ac.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                ac.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });
                ac.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis3
                });

                pa.Append(ac);
            }

            #endregion

            #region Bar3D

            iChartType = (int)SLDataSeriesChartType.Bar3DChart;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.Bar3DChart();
                bc.BarDirection = new C.BarDirection {
                    Val = UsedChartOptions[iChartType].BarDirection
                };
                bc.BarGrouping = new C.BarGrouping {
                    Val = UsedChartOptions[iChartType].BarGrouping
                };
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBarChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                bc.Append(new C.GapWidth {
                    Val = UsedChartOptions[iChartType].GapWidth
                });

                if (UsedChartOptions[iChartType].GapDepth != 150)
                {
                    bc.Append(new C.GapDepth {
                        Val = UsedChartOptions[iChartType].GapDepth
                    });
                }

                bc.Append(new C.Shape {
                    Val = UsedChartOptions[iChartType].Shape
                });

                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis3
                });

                pa.Append(bc);
            }

            #endregion

            #region Bubble

            iChartType = (int)SLDataSeriesChartType.BubbleChart;
            if (UsedChartTypes[iChartType])
            {
                var bc = new C.BubbleChart();
                bc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        bc.Append(DataSeries[i].ToBubbleChartSeries(IsStylish));
                    }
                }

                bc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (!UsedChartOptions[iChartType].Bubble3D)
                {
                    bc.Append(new C.Bubble3D {
                        Val = UsedChartOptions[iChartType].Bubble3D
                    });
                }

                if (UsedChartOptions[iChartType].BubbleScale != 100)
                {
                    bc.Append(new C.BubbleScale {
                        Val = UsedChartOptions[iChartType].BubbleScale
                    });
                }

                if (!UsedChartOptions[iChartType].ShowNegativeBubbles)
                {
                    bc.Append(new C.ShowNegativeBubbles {
                        Val = UsedChartOptions[iChartType].ShowNegativeBubbles
                    });
                }

                if (UsedChartOptions[iChartType].SizeRepresents != C.SizeRepresentsValues.Area)
                {
                    bc.Append(new C.SizeRepresents {
                        Val = UsedChartOptions[iChartType].SizeRepresents
                    });
                }

                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                bc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });

                pa.Append(bc);
            }

            #endregion

            #region Line3D

            iChartType = (int)SLDataSeriesChartType.Line3DChart;
            if (UsedChartTypes[iChartType])
            {
                var lc = new C.Line3DChart();
                lc.Grouping = new C.Grouping {
                    Val = UsedChartOptions[iChartType].Grouping
                };
                lc.VaryColors = new C.VaryColors {
                    Val = false
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        lc.Append(DataSeries[i].ToLineChartSeries(IsStylish));
                    }
                }

                lc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    lc.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                if (UsedChartOptions[iChartType].GapDepth != 150)
                {
                    lc.Append(new C.GapDepth {
                        Val = UsedChartOptions[iChartType].GapDepth
                    });
                }

                lc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                lc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });
                lc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis3
                });

                pa.Append(lc);
            }

            #endregion

            #region Pie3D

            iChartType = (int)SLDataSeriesChartType.Pie3DChart;
            if (UsedChartTypes[iChartType])
            {
                var pc = new C.Pie3DChart();
                pc.VaryColors = new C.VaryColors {
                    Val = UsedChartOptions[iChartType].VaryColors ?? true
                };

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        pc.Append(DataSeries[i].ToPieChartSeries(IsStylish));
                    }
                }

                pc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                pa.Append(pc);
            }

            #endregion

            #region Surface

            iChartType = (int)SLDataSeriesChartType.SurfaceChart;
            if (UsedChartTypes[iChartType])
            {
                var sc = new C.SurfaceChart();
                if (UsedChartOptions[iChartType].bWireframe != null)
                {
                    sc.Wireframe = new C.Wireframe {
                        Val = UsedChartOptions[iChartType].Wireframe
                    }
                }
                ;

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(DataSeries[i].ToSurfaceChartSeries(IsStylish));
                    }
                }

                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis3
                });

                pa.Append(sc);
            }

            #endregion

            #region Surface3D

            iChartType = (int)SLDataSeriesChartType.Surface3DChart;
            if (UsedChartTypes[iChartType])
            {
                var sc = new C.Surface3DChart();
                if (UsedChartOptions[iChartType].bWireframe != null)
                {
                    sc.Wireframe = new C.Wireframe {
                        Val = UsedChartOptions[iChartType].Wireframe
                    }
                }
                ;

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(DataSeries[i].ToSurfaceChartSeries(IsStylish));
                    }
                }

                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis1
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis2
                });
                sc.Append(new C.AxisId {
                    Val = SLConstants.PrimaryAxis3
                });

                pa.Append(sc);
            }

            #endregion

            #region Stock

            iChartType = (int)SLDataSeriesChartType.StockChart;
            if (UsedChartTypes[iChartType])
            {
                var sc = new C.StockChart();

                for (i = 0; i < DataSeries.Count; ++i)
                {
                    if ((int)DataSeries[i].ChartType == iChartType)
                    {
                        sc.Append(DataSeries[i].ToLineChartSeries(IsStylish));
                    }
                }

                sc.Append(gdlo.ToDataLabels(new Dictionary <int, SLDataLabelOptions>(), false));

                if (UsedChartOptions[iChartType].HasDropLines)
                {
                    sc.Append(UsedChartOptions[iChartType].DropLines.ToDropLines(IsStylish));
                }

                if (UsedChartOptions[iChartType].HasHighLowLines)
                {
                    sc.Append(UsedChartOptions[iChartType].HighLowLines.ToHighLowLines(IsStylish));
                }

                if (UsedChartOptions[iChartType].HasUpDownBars)
                {
                    sc.Append(UsedChartOptions[iChartType].UpDownBars.ToUpDownBars(IsStylish));
                }

                // stock charts either have a bar chart as the primary chart (the Volume) or doesn't.
                // If there is, then it's either a Volume-High-Low-Close or Volumn-Open-High-Low-Close,
                // so we use the secondary axis IDs.
                if (UsedChartTypes[(int)SLDataSeriesChartType.BarChartColumnPrimary])
                {
                    sc.Append(new C.AxisId {
                        Val = SLConstants.SecondaryAxis1
                    });
                    sc.Append(new C.AxisId {
                        Val = SLConstants.SecondaryAxis2
                    });
                }
                else
                {
                    sc.Append(new C.AxisId {
                        Val = SLConstants.PrimaryAxis1
                    });
                    sc.Append(new C.AxisId {
                        Val = SLConstants.PrimaryAxis2
                    });
                }

                pa.Append(sc);
            }

            #endregion

            if (HasPrimaryAxes)
            {
                PrimaryTextAxis.IsCrosses = PrimaryValueAxis.OtherAxisIsCrosses;
                PrimaryTextAxis.Crosses   = PrimaryValueAxis.OtherAxisCrosses;
                PrimaryTextAxis.CrossesAt = PrimaryValueAxis.OtherAxisCrossesAt;

                PrimaryTextAxis.OtherAxisIsInReverseOrder = PrimaryValueAxis.InReverseOrder;

                if ((PrimaryValueAxis.OtherAxisIsCrosses != null) &&
                    PrimaryValueAxis.OtherAxisIsCrosses.Value &&
                    (PrimaryValueAxis.OtherAxisCrosses == C.CrossesValues.Maximum))
                {
                    PrimaryTextAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    PrimaryTextAxis.OtherAxisCrossedAtMaximum = false;
                }

                PrimaryValueAxis.IsCrosses = PrimaryTextAxis.OtherAxisIsCrosses;
                PrimaryValueAxis.Crosses   = PrimaryTextAxis.OtherAxisCrosses;
                PrimaryValueAxis.CrossesAt = PrimaryTextAxis.OtherAxisCrossesAt;

                PrimaryValueAxis.OtherAxisIsInReverseOrder = PrimaryTextAxis.InReverseOrder;

                if ((PrimaryTextAxis.OtherAxisIsCrosses != null) &&
                    PrimaryTextAxis.OtherAxisIsCrosses.Value &&
                    (PrimaryTextAxis.OtherAxisCrosses == C.CrossesValues.Maximum))
                {
                    PrimaryValueAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    PrimaryValueAxis.OtherAxisCrossedAtMaximum = false;
                }

                switch (PrimaryTextAxis.AxisType)
                {
                case SLAxisType.Category:
                    pa.Append(PrimaryTextAxis.ToCategoryAxis(IsStylish));
                    break;

                case SLAxisType.Date:
                    pa.Append(PrimaryTextAxis.ToDateAxis(IsStylish));
                    break;

                case SLAxisType.Value:
                    pa.Append(PrimaryTextAxis.ToValueAxis(IsStylish));
                    break;
                }
                pa.Append(PrimaryValueAxis.ToValueAxis(IsStylish));
            }

            if (HasDepthAxis)
            {
                pa.Append(DepthAxis.ToSeriesAxis(IsStylish));
            }

            if (HasSecondaryAxes)
            {
                SecondaryTextAxis.IsCrosses = SecondaryValueAxis.OtherAxisIsCrosses;
                SecondaryTextAxis.Crosses   = SecondaryValueAxis.OtherAxisCrosses;
                SecondaryTextAxis.CrossesAt = SecondaryValueAxis.OtherAxisCrossesAt;

                SecondaryTextAxis.OtherAxisIsInReverseOrder = SecondaryValueAxis.InReverseOrder;

                if ((SecondaryValueAxis.OtherAxisIsCrosses != null) &&
                    SecondaryValueAxis.OtherAxisIsCrosses.Value &&
                    (SecondaryValueAxis.OtherAxisCrosses == C.CrossesValues.Maximum))
                {
                    SecondaryTextAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    SecondaryTextAxis.OtherAxisCrossedAtMaximum = false;
                }

                SecondaryValueAxis.IsCrosses = SecondaryTextAxis.OtherAxisIsCrosses;
                SecondaryValueAxis.Crosses   = SecondaryTextAxis.OtherAxisCrosses;
                SecondaryValueAxis.CrossesAt = SecondaryTextAxis.OtherAxisCrossesAt;

                SecondaryValueAxis.OtherAxisIsInReverseOrder = SecondaryTextAxis.InReverseOrder;

                if ((SecondaryTextAxis.OtherAxisIsCrosses != null) &&
                    SecondaryTextAxis.OtherAxisIsCrosses.Value &&
                    (SecondaryTextAxis.OtherAxisCrosses == C.CrossesValues.Maximum))
                {
                    SecondaryValueAxis.OtherAxisCrossedAtMaximum = true;
                }
                else
                {
                    SecondaryValueAxis.OtherAxisCrossedAtMaximum = false;
                }

                // the order of axes is:
                // 1) primary category/date/value axis
                // 2) primary value axis
                // 3) secondary value axis
                // 4) secondary category/date/value axis
                pa.Append(SecondaryValueAxis.ToValueAxis(IsStylish));
                switch (SecondaryTextAxis.AxisType)
                {
                case SLAxisType.Category:
                    pa.Append(SecondaryTextAxis.ToCategoryAxis(IsStylish));
                    break;

                case SLAxisType.Date:
                    pa.Append(SecondaryTextAxis.ToDateAxis(IsStylish));
                    break;

                case SLAxisType.Value:
                    pa.Append(SecondaryTextAxis.ToValueAxis(IsStylish));
                    break;
                }
            }

            if (ShowDataTable)
            {
                pa.Append(DataTable.ToDataTable(IsStylish));
            }

            if (ShapeProperties.HasShapeProperties)
            {
                pa.Append(ShapeProperties.ToChartShapeProperties(IsStylish));
            }

            return(pa);
        }