internal C.Marker ToMarker(bool IsStylish = false) { var m = new C.Marker(); if (vSymbol != null) { m.Symbol = new C.Symbol { Val = vSymbol.Value } } ; if (bySize != null) { m.Size = new C.Size { Val = bySize.Value } } ; if (ShapeProperties.HasShapeProperties) { m.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(m); }
internal C.DropLines ToDropLines(bool IsStylish = false) { var dl = new C.DropLines(); dl.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); return(dl); }
internal C.UpBars ToUpBars(bool IsStylish = false) { var ub = new C.UpBars(); if (ShapeProperties.HasShapeProperties) { ub.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(ub); }
internal C.HighLowLines ToHighLowLines(bool IsStylish = false) { var hll = new C.HighLowLines(); if (ShapeProperties.HasShapeProperties) { hll.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(hll); }
internal C.MinorGridlines ToMinorGridlines(bool IsStylish = false) { var mgl = new C.MinorGridlines(); if (ShapeProperties.HasShapeProperties) { mgl.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(mgl); }
internal C.DownBars ToDownBars(bool IsStylish = false) { var db = new C.DownBars(); if (ShapeProperties.HasShapeProperties) { db.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(db); }
internal C.DataPoint ToDataPoint(int index, bool IsStylish = false) { var pt = new C.DataPoint(); pt.Index = new C.Index { Val = (uint)index }; if (Marker.HasMarker) { pt.Marker = Marker.ToMarker(IsStylish); } if (bBubble3D != null) { pt.Bubble3D = new C.Bubble3D { Val = bBubble3D.Value } } ; if (iExplosion != null) { pt.Explosion = new C.Explosion { Val = iExplosion.Value } } ; if (ShapeProperties.HasShapeProperties) { pt.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } return(pt); }
internal C.ValueAxis ToValueAxis(bool IsStylish = false) { var va = new C.ValueAxis(); va.AxisId = new C.AxisId { Val = AxisId }; va.Scaling = new C.Scaling(); va.Scaling.Orientation = new C.Orientation { Val = Orientation }; if (LogBase != null) { va.Scaling.LogBase = new C.LogBase { Val = LogBase.Value } } ; if (MaxAxisValue != null) { va.Scaling.MaxAxisValue = new C.MaxAxisValue { Val = MaxAxisValue.Value } } ; if (MinAxisValue != null) { va.Scaling.MinAxisValue = new C.MinAxisValue { Val = MinAxisValue.Value } } ; va.Delete = new C.Delete { Val = Delete }; var axpos = AxisPosition; if (!ForceAxisPosition) { if (OtherAxisIsInReverseOrder) { axpos = SLChartTool.GetOppositePosition(axpos); } if (OtherAxisCrossedAtMaximum) { axpos = SLChartTool.GetOppositePosition(axpos); } } va.AxisPosition = new C.AxisPosition { Val = axpos }; if (ShowMajorGridlines) { va.MajorGridlines = MajorGridlines.ToMajorGridlines(IsStylish); } if (ShowMinorGridlines) { va.MinorGridlines = MinorGridlines.ToMinorGridlines(IsStylish); } if (ShowTitle) { va.Title = Title.ToTitle(IsStylish); } if (HasNumberingFormat) { va.NumberingFormat = new C.NumberingFormat { FormatCode = FormatCode, SourceLinked = SourceLinked } } ; va.MajorTickMark = new C.MajorTickMark { Val = MajorTickMark }; va.MinorTickMark = new C.MinorTickMark { Val = MinorTickMark }; va.TickLabelPosition = new C.TickLabelPosition { Val = TickLabelPosition }; if (ShapeProperties.HasShapeProperties) { va.ChartShapeProperties = ShapeProperties.ToChartShapeProperties(IsStylish); } if ((Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null)) { va.TextProperties = new C.TextProperties(); va.TextProperties.BodyProperties = new A.BodyProperties(); if (Rotation != null) { va.TextProperties.BodyProperties.Rotation = (int)(Rotation.Value * SLConstants.DegreeToAngleRepresentation); } if (Vertical != null) { va.TextProperties.BodyProperties.Vertical = Vertical.Value; } if (Anchor != null) { va.TextProperties.BodyProperties.Anchor = Anchor.Value; } if (AnchorCenter != null) { va.TextProperties.BodyProperties.AnchorCenter = AnchorCenter.Value; } va.TextProperties.ListStyle = new A.ListStyle(); var para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); para.ParagraphProperties.Append(new A.DefaultRunProperties()); va.TextProperties.Append(para); } else if (IsStylish) { va.TextProperties = new C.TextProperties(); va.TextProperties.BodyProperties = new A.BodyProperties { Rotation = -60000000, UseParagraphSpacing = true, VerticalOverflow = A.TextVerticalOverflowValues.Ellipsis, Vertical = A.TextVerticalValues.Horizontal, Wrap = A.TextWrappingValues.Square, Anchor = A.TextAnchoringTypeValues.Center, AnchorCenter = true }; va.TextProperties.ListStyle = new A.ListStyle(); var para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); var defrunprops = new A.DefaultRunProperties(); defrunprops.FontSize = 900; defrunprops.Bold = false; defrunprops.Italic = false; defrunprops.Underline = A.TextUnderlineValues.None; defrunprops.Strike = A.TextStrikeValues.NoStrike; defrunprops.Kerning = 1200; defrunprops.Baseline = 0; var schclr = new A.SchemeColor { Val = A.SchemeColorValues.Text1 }; schclr.Append(new A.LuminanceModulation { Val = 65000 }); schclr.Append(new A.LuminanceOffset { Val = 35000 }); defrunprops.Append(new A.SolidFill { SchemeColor = schclr }); defrunprops.Append(new A.LatinFont { Typeface = "+mn-lt" }); defrunprops.Append(new A.EastAsianFont { Typeface = "+mn-ea" }); defrunprops.Append(new A.ComplexScriptFont { Typeface = "+mn-cs" }); para.ParagraphProperties.Append(defrunprops); para.Append(new A.EndParagraphRunProperties { Language = CultureInfo.CurrentCulture.Name }); va.TextProperties.Append(para); } va.CrossingAxis = new C.CrossingAxis { Val = CrossingAxis }; if (IsCrosses != null) { if (IsCrosses.Value) { va.Append(new C.Crosses { Val = Crosses }); } else { va.Append(new C.CrossesAt { Val = CrossesAt }); } } va.Append(new C.CrossBetween { Val = CrossBetween }); if (MajorUnit != null) { va.Append(new C.MajorUnit { Val = MajorUnit.Value }); } if (MinorUnit != null) { va.Append(new C.MinorUnit { Val = MinorUnit.Value }); } if (BuiltInUnitValues != null) { var du = new C.DisplayUnits(); du.Append(new C.BuiltInUnit { Val = BuiltInUnitValues.Value }); if (ShowDisplayUnitsLabel) { var dul = new C.DisplayUnitsLabel(); dul.Layout = new C.Layout(); du.Append(dul); } va.Append(du); } return(va); }
internal C.DataLabels ToDataLabels(Dictionary <int, SLDataLabelOptions> Options, bool ToDelete) { var lbls = new C.DataLabels(); if (Options.Count > 0) { var indexlist = Options.Keys.ToList(); indexlist.Sort(); int index; for (var i = 0; i < indexlist.Count; ++i) { index = indexlist[i]; lbls.Append(Options[index].ToDataLabel(index)); } } if (ToDelete) { lbls.Append(new C.Delete { Val = true }); } else { if (HasNumberingFormat) { lbls.Append(new C.NumberingFormat { FormatCode = FormatCode, SourceLinked = SourceLinked }); } if (ShapeProperties.HasShapeProperties) { lbls.Append(ShapeProperties.ToChartShapeProperties()); } if ((Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null)) { var txtprops = new C.TextProperties(); txtprops.BodyProperties = new A.BodyProperties(); if (Rotation != null) { txtprops.BodyProperties.Rotation = (int)(Rotation.Value * SLConstants.DegreeToAngleRepresentation); } if (Vertical != null) { txtprops.BodyProperties.Vertical = Vertical.Value; } if (Anchor != null) { txtprops.BodyProperties.Anchor = Anchor.Value; } if (AnchorCenter != null) { txtprops.BodyProperties.AnchorCenter = AnchorCenter.Value; } txtprops.ListStyle = new A.ListStyle(); var para = new A.Paragraph(); para.ParagraphProperties = new A.ParagraphProperties(); para.ParagraphProperties.Append(new A.DefaultRunProperties()); txtprops.Append(para); lbls.Append(txtprops); } if (vLabelPosition != null) { lbls.Append(new C.DataLabelPosition { Val = vLabelPosition.Value }); } lbls.Append(new C.ShowLegendKey { Val = ShowLegendKey }); lbls.Append(new C.ShowValue { Val = ShowValue }); lbls.Append(new C.ShowCategoryName { Val = ShowCategoryName }); lbls.Append(new C.ShowSeriesName { Val = ShowSeriesName }); lbls.Append(new C.ShowPercent { Val = ShowPercentage }); lbls.Append(new C.ShowBubbleSize { Val = ShowBubbleSize }); if ((Separator != null) && (Separator.Length > 0)) { lbls.Append(new C.Separator { Text = Separator }); } if (ShowLeaderLines) { lbls.Append(new C.ShowLeaderLines { Val = ShowLeaderLines }); } } return(lbls); }
internal C.DataLabel ToDataLabel(int index) { var lbl = new C.DataLabel(); lbl.Index = new C.Index { Val = (uint)index }; lbl.Append(new C.Layout()); if ((RichText != null) || (Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null)) { var ctxt = new C.ChartText(); ctxt.RichText = new C.RichText(); ctxt.RichText.BodyProperties = new A.BodyProperties(); if ((Rotation != null) || (Vertical != null) || (Anchor != null) || (AnchorCenter != null)) { if (Rotation != null) { ctxt.RichText.BodyProperties.Rotation = (int)(Rotation.Value * SLConstants.DegreeToAngleRepresentation); } if (Vertical != null) { ctxt.RichText.BodyProperties.Vertical = Vertical.Value; } if (Anchor != null) { ctxt.RichText.BodyProperties.Anchor = Anchor.Value; } if (AnchorCenter != null) { ctxt.RichText.BodyProperties.AnchorCenter = AnchorCenter.Value; } } ctxt.RichText.ListStyle = new A.ListStyle(); if (RichText != null) { ctxt.RichText.Append(RichText.ToParagraph()); } lbl.Append(ctxt); } if (HasNumberingFormat) { lbl.Append(new C.NumberingFormat { FormatCode = FormatCode, SourceLinked = SourceLinked }); } if (ShapeProperties.HasShapeProperties) { lbl.Append(ShapeProperties.ToChartShapeProperties()); } if (vLabelPosition != null) { lbl.Append(new C.DataLabelPosition { Val = vLabelPosition.Value }); } lbl.Append(new C.ShowLegendKey { Val = ShowLegendKey }); lbl.Append(new C.ShowValue { Val = ShowValue }); lbl.Append(new C.ShowCategoryName { Val = ShowCategoryName }); lbl.Append(new C.ShowSeriesName { Val = ShowSeriesName }); lbl.Append(new C.ShowPercent { Val = ShowPercentage }); lbl.Append(new C.ShowBubbleSize { Val = ShowBubbleSize }); if ((Separator != null) && (Separator.Length > 0)) { lbl.Append(new C.Separator { Text = Separator }); } return(lbl); }
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); }