internal ExcelChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot)
     : base(ns, node)
 {
     _ns             = ns;
     _chart          = chart;
     _node           = node;
     _isPivot        = isPivot;
     SchemaNodeOrder = new string[] { "view3D", "plotArea", "barDir", "grouping", "scatterStyle", "varyColors", "ser", "explosion", "dLbls", "firstSliceAng", "holeSize", "shape", "legend", "axId" };
     foreach (XmlNode n in node.SelectNodes("c:ser", ns))
     {
         ExcelChartSerie s;
         if (chart.ChartNode.LocalName == "scatterChart")
         {
             s = new ExcelScatterChartSerie(this, ns, n, isPivot);
         }
         else if (chart.ChartNode.LocalName == "lineChart")
         {
             s = new ExcelLineChartSerie(this, ns, n, isPivot);
         }
         else if (chart.ChartNode.LocalName == "pieChart" ||
                  chart.ChartNode.LocalName == "ofPieChart" ||
                  chart.ChartNode.LocalName == "pie3DChart" ||
                  chart.ChartNode.LocalName == "doughnutChart")
         {
             s = new ExcelPieChartSerie(this, ns, n, isPivot);
         }
         else
         {
             s = new ExcelChartSerie(this, ns, n, isPivot);
         }
         _list.Add(s);
     }
 }
 internal ExcelChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot)
     : base(ns,node)
 {
     _ns = ns;
     _chart=chart;
     _node=node;
     _isPivot = isPivot;
     SchemaNodeOrder = new string[] { "view3D", "plotArea", "barDir", "grouping", "scatterStyle", "varyColors", "ser", "explosion", "dLbls", "firstSliceAng", "holeSize", "shape", "legend", "axId" };
     foreach(XmlNode n in node.SelectNodes("c:ser",ns))
     {
         ExcelChartSerie s;
         if (chart.ChartNode.LocalName == "scatterChart")
         {
             s = new ExcelScatterChartSerie(this, ns, n, isPivot);
         }
         else if (chart.ChartNode.LocalName == "lineChart")
         {
             s = new ExcelLineChartSerie(this, ns, n, isPivot);
         }
         else if (chart.ChartNode.LocalName == "pieChart" ||
                  chart.ChartNode.LocalName == "ofPieChart" ||
                  chart.ChartNode.LocalName == "pie3DChart" ||
                  chart.ChartNode.LocalName == "doughnutChart")                                                                       
         {
             s = new ExcelPieChartSerie(this, ns, n, isPivot);
         }
         else
         {
             s = new ExcelChartSerie(this, ns, n, isPivot);
         }
         _list.Add(s);
     }
 }
        private void AddSeriesStandard(ExcelChart chart, XmlNamespaceManager ns, XmlNode chartNode, bool isPivot)
        {
            foreach (XmlNode n in chartNode.SelectNodes("c:ser", ns))
            {
                ExcelChartSerie s;
                switch (chart.ChartNode.LocalName)
                {
                case "barChart":
                case "bar3DChart":
                    s = new ExcelBarChartSerie(_chart, ns, n, isPivot);
                    break;

                case "lineChart":
                case "line3DChart":
                    s = new ExcelLineChartSerie(_chart, ns, n, isPivot);
                    break;

                case "stockChart":
                    s = new ExcelStockChartSerie(_chart, ns, n, isPivot);
                    break;

                case "scatterChart":
                    s = new ExcelScatterChartSerie(_chart, ns, n, isPivot);
                    break;

                case "pieChart":
                case "pie3DChart":
                case "ofPieChart":
                case "doughnutChart":
                    s = new ExcelPieChartSerie(_chart, ns, n, isPivot);
                    break;

                case "bubbleChart":
                    s = new ExcelBubbleChartSerie(_chart, ns, n, isPivot);
                    break;

                case "radarChart":
                    s = new ExcelRadarChartSerie(_chart, ns, n, isPivot);
                    break;

                case "surfaceChart":
                case "surface3DChart":
                    s = new ExcelSurfaceChartSerie(_chart, ns, n, isPivot);
                    break;

                case "areaChart":
                case "area3DChart":
                    s = new ExcelAreaChartSerie(_chart, ns, n, isPivot);
                    break;

                default:
                    s = new ExcelChartStandardSerie(_chart, ns, n, isPivot);
                    break;
                }
                _list.Add((T)s);
            }
        }
Exemple #4
0
        internal void Init(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot, List <ExcelChartSerie> list = null)
        {
            _ns      = ns;
            _chart   = chart;
            _node    = node;
            _isPivot = isPivot;
            if (list == null)
            {
                _list = new List <ExcelChartSerie>();
            }
            else
            {
                _list = list;
                return;
            }
            //SchemaNodeOrder = new string[] { "view3D", "plotArea", "barDir", "grouping", "scatterStyle", "varyColors", "ser", "marker", "invertIfNegative", "pictureOptions", "dPt", "explosion", "dLbls", "firstSliceAng", "holeSize", "shape", "legend", "axId" };
            foreach (XmlNode n in node.SelectNodes("c:ser", ns))
            {
                ExcelChartSerie s;
                switch (chart.ChartNode.LocalName)
                {
                case "barChart":
                case "bar3DChart":
                    s = new ExcelBarChartSerie(_chart, ns, n, isPivot);
                    break;

                case "lineChart":
                case "line3DChart":
                case "stockChart":
                    s = new ExcelLineChartSerie(_chart, ns, n, isPivot);
                    break;

                case "scatterChart":
                    s = new ExcelScatterChartSerie(_chart, ns, n, isPivot);
                    break;

                case "pieChart":
                case "pie3DChart":
                case "ofPieChart":
                case "doughnutChart":
                    s = new ExcelPieChartSerie(_chart, ns, n, isPivot);
                    break;

                case "bubbleChart":
                    s = new ExcelBubbleChartSerie(_chart, ns, n, isPivot);
                    break;

                case "radarChart":
                    s = new ExcelRadarChartSerie(_chart, ns, n, isPivot);
                    break;

                case "surfaceChart":
                case "surface3DChart":
                    s = new ExcelSurfaceChartSerie(_chart, ns, n, isPivot);
                    break;

                case "areaChart":
                case "area3DChart":
                    s = new ExcelAreaChartSerie(_chart, ns, n, isPivot);
                    break;

                default:
                    s = new ExcelChartSerie(_chart, ns, n, isPivot);
                    break;
                }
                _list.Add((T)s);
            }
        }
Exemple #5
0
        /// <summary>
        /// Adds a new serie to the chart
        /// </summary>
        /// <param name="SerieAddress">The Y-Axis range</param>
        /// <param name="XSerieAddress">The X-Axis range</param>
        /// <param name="bubbleSizeAddress">Bubble chart size</param>
        /// <returns></returns>
        internal protected T AddSeries(string SerieAddress, string XSerieAddress, string bubbleSizeAddress)
        {
            if (_list.Count == 256)
            {
                throw (new InvalidOperationException("Charts have a maximum of 256 series."));
            }
            XmlElement  ser  = _node.OwnerDocument.CreateElement("c", "ser", ExcelPackage.schemaChart);
            XmlNodeList node = _node.SelectNodes("c:ser", _ns);

            if (node.Count > 0)
            {
                _node.InsertAfter(ser, node[node.Count - 1]);
            }
            else
            {
                var f = XmlHelperFactory.Create(_ns, _node);
                f.InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle,c:ofPieType", ser);
            }

            //If the chart is added from a chart template, then use the chart templates series xml
            if (!string.IsNullOrEmpty(_chart._drawings._seriesTemplateXml))
            {
                ser.InnerXml = _chart._drawings._seriesTemplateXml;
            }

            int idx = FindIndex();

            ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{2}{5}{0}{3}{4}", AddExplosion(Chart.ChartType), idx, AddSpPrAndScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
            ExcelChartSerie serie;

            switch (Chart.ChartType)
            {
            case eChartType.Bubble:
            case eChartType.Bubble3DEffect:
                serie = new ExcelBubbleChartSerie(_chart, _ns, ser, _isPivot)
                {
                    Bubble3D   = Chart.ChartType == eChartType.Bubble3DEffect,
                    Series     = SerieAddress,
                    XSeries    = XSerieAddress,
                    BubbleSize = bubbleSizeAddress
                };
                break;

            case eChartType.XYScatter:
            case eChartType.XYScatterLines:
            case eChartType.XYScatterLinesNoMarkers:
            case eChartType.XYScatterSmooth:
            case eChartType.XYScatterSmoothNoMarkers:
                serie = new ExcelScatterChartSerie(_chart, _ns, ser, _isPivot);
                break;

            case eChartType.Radar:
            case eChartType.RadarFilled:
            case eChartType.RadarMarkers:
                serie = new ExcelRadarChartSerie(_chart, _ns, ser, _isPivot);
                break;

            case eChartType.Surface:
            case eChartType.SurfaceTopView:
            case eChartType.SurfaceTopViewWireframe:
            case eChartType.SurfaceWireframe:
                serie = new ExcelSurfaceChartSerie(_chart, _ns, ser, _isPivot);
                break;

            case eChartType.Pie:
            case eChartType.Pie3D:
            case eChartType.PieExploded:
            case eChartType.PieExploded3D:
            case eChartType.PieOfPie:
            case eChartType.Doughnut:
            case eChartType.DoughnutExploded:
            case eChartType.BarOfPie:
                serie = new ExcelPieChartSerie(_chart, _ns, ser, _isPivot);
                break;

            case eChartType.Line:
            case eChartType.LineMarkers:
            case eChartType.LineMarkersStacked:
            case eChartType.LineMarkersStacked100:
            case eChartType.LineStacked:
            case eChartType.LineStacked100:
            case eChartType.Line3D:
                serie = new ExcelLineChartSerie(_chart, _ns, ser, _isPivot);
                if (Chart.ChartType == eChartType.LineMarkers ||
                    Chart.ChartType == eChartType.LineMarkersStacked ||
                    Chart.ChartType == eChartType.LineMarkersStacked100)
                {
                    ((ExcelLineChartSerie)serie).Marker.Style = eMarkerStyle.Square;
                }
                ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                break;

            case eChartType.BarClustered:
            case eChartType.BarStacked:
            case eChartType.BarStacked100:
            case eChartType.ColumnClustered:
            case eChartType.ColumnStacked:
            case eChartType.ColumnStacked100:
            case eChartType.BarClustered3D:
            case eChartType.BarStacked3D:
            case eChartType.BarStacked1003D:
            case eChartType.Column3D:
            case eChartType.ColumnClustered3D:
            case eChartType.ColumnStacked3D:
            case eChartType.ColumnStacked1003D:
            case eChartType.ConeBarClustered:
            case eChartType.ConeBarStacked:
            case eChartType.ConeBarStacked100:
            case eChartType.ConeCol:
            case eChartType.ConeColClustered:
            case eChartType.ConeColStacked:
            case eChartType.ConeColStacked100:
            case eChartType.CylinderBarClustered:
            case eChartType.CylinderBarStacked:
            case eChartType.CylinderBarStacked100:
            case eChartType.CylinderCol:
            case eChartType.CylinderColClustered:
            case eChartType.CylinderColStacked:
            case eChartType.CylinderColStacked100:
            case eChartType.PyramidBarClustered:
            case eChartType.PyramidBarStacked:
            case eChartType.PyramidBarStacked100:
            case eChartType.PyramidCol:
            case eChartType.PyramidColClustered:
            case eChartType.PyramidColStacked:
            case eChartType.PyramidColStacked100:
                serie = new ExcelBarChartSerie(_chart, _ns, ser, _isPivot);
                ((ExcelBarChartSerie)serie).InvertIfNegative = false;
                break;

            case eChartType.Area:
            case eChartType.Area3D:
            case eChartType.AreaStacked:
            case eChartType.AreaStacked100:
            case eChartType.AreaStacked1003D:
            case eChartType.AreaStacked3D:
                serie = new ExcelAreaChartSerie(_chart, _ns, ser, _isPivot);
                break;

            default:
                serie = new ExcelChartSerie(_chart, _ns, ser, _isPivot);
                break;
            }
            serie.Series  = SerieAddress;
            serie.XSeries = XSerieAddress;
            _list.Add((T)serie);
            if (_chart.StyleManager.StylePart != null)
            {
                _chart.StyleManager.ApplySeries();
            }
            return((T)serie);
        }
Exemple #6
0
        internal protected ExcelChartSerie AddSeries(string SeriesAddress, string XSeriesAddress, string bubbleSizeAddress)
        {
            XmlElement  ser  = _node.OwnerDocument.CreateElement("ser", ExcelPackage.schemaChart);
            XmlNodeList node = _node.SelectNodes("c:ser", _ns);

            if (node.Count > 0)
            {
                _node.InsertAfter(ser, node[node.Count - 1]);
            }
            else
            {
                InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle,c:ofPieType", ser);
            }
            int idx = FindIndex();

            ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{5}{0}{2}{3}{4}", AddExplosion(Chart.ChartType), idx, AddScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
            ExcelChartSerie serie;

            switch (Chart.ChartType)
            {
            case eChartType.Bubble:
            case eChartType.Bubble3DEffect:
                serie = new ExcelBubbleChartSerie(this, NameSpaceManager, ser, _isPivot)
                {
                    Bubble3D   = Chart.ChartType == eChartType.Bubble3DEffect,
                    Series     = SeriesAddress,
                    XSeries    = XSeriesAddress,
                    BubbleSize = bubbleSizeAddress
                };
                break;

            case eChartType.XYScatter:
            case eChartType.XYScatterLines:
            case eChartType.XYScatterLinesNoMarkers:
            case eChartType.XYScatterSmooth:
            case eChartType.XYScatterSmoothNoMarkers:
                serie = new ExcelScatterChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Radar:
            case eChartType.RadarFilled:
            case eChartType.RadarMarkers:
                serie = new ExcelRadarChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Surface:
            case eChartType.SurfaceTopView:
            case eChartType.SurfaceTopViewWireframe:
            case eChartType.SurfaceWireframe:
                serie = new ExcelSurfaceChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Pie:
            case eChartType.Pie3D:
            case eChartType.PieExploded:
            case eChartType.PieExploded3D:
            case eChartType.PieOfPie:
            case eChartType.Doughnut:
            case eChartType.DoughnutExploded:
            case eChartType.BarOfPie:
                serie = new ExcelPieChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Line:
            case eChartType.LineMarkers:
            case eChartType.LineMarkersStacked:
            case eChartType.LineMarkersStacked100:
            case eChartType.LineStacked:
            case eChartType.LineStacked100:
                serie = new ExcelLineChartSerie(this, NameSpaceManager, ser, _isPivot);
                if (Chart.ChartType == eChartType.LineMarkers ||
                    Chart.ChartType == eChartType.LineMarkersStacked ||
                    Chart.ChartType == eChartType.LineMarkersStacked100)
                {
                    ((ExcelLineChartSerie)serie).Marker = eMarkerStyle.Square;
                }
                ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                break;

            case eChartType.BarClustered:
            case eChartType.BarStacked:
            case eChartType.BarStacked100:
            case eChartType.ColumnClustered:
            case eChartType.ColumnStacked:
            case eChartType.ColumnStacked100:
            case eChartType.BarClustered3D:
            case eChartType.BarStacked3D:
            case eChartType.BarStacked1003D:
            case eChartType.ColumnClustered3D:
            case eChartType.ColumnStacked3D:
            case eChartType.ColumnStacked1003D:
            case eChartType.ConeBarClustered:
            case eChartType.ConeBarStacked:
            case eChartType.ConeBarStacked100:
            case eChartType.ConeCol:
            case eChartType.ConeColClustered:
            case eChartType.ConeColStacked:
            case eChartType.ConeColStacked100:
            case eChartType.CylinderBarClustered:
            case eChartType.CylinderBarStacked:
            case eChartType.CylinderBarStacked100:
            case eChartType.CylinderCol:
            case eChartType.CylinderColClustered:
            case eChartType.CylinderColStacked:
            case eChartType.CylinderColStacked100:
            case eChartType.PyramidBarClustered:
            case eChartType.PyramidBarStacked:
            case eChartType.PyramidBarStacked100:
            case eChartType.PyramidCol:
            case eChartType.PyramidColClustered:
            case eChartType.PyramidColStacked:
            case eChartType.PyramidColStacked100:
                serie = new ExcelBarChartSerie(this, NameSpaceManager, ser, _isPivot);
                ((ExcelBarChartSerie)serie).InvertIfNegative = false;
                break;

            default:
                serie = new ExcelChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;
            }
            serie.Series  = SeriesAddress;
            serie.XSeries = XSeriesAddress;
            _list.Add(serie);
            return(serie);
        }
       private ExcelChartSerie AddSeries(string SeriesAddress, string XSeriesAddress)
        {
               XmlElement ser = _node.OwnerDocument.CreateElement("ser", ExcelPackage.schemaChart);
               XmlNodeList node = _node.SelectNodes("c:ser", _ns);
               if (node.Count > 0)
               {
                   _node.InsertAfter(ser, node[node.Count-1]);
               }
               else
               {
                   InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle", ser);
                }
               int idx = FindIndex();
               ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{5}{0}{2}{3}{4}", AddExplosion(Chart.ChartType), idx, AddScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
               ExcelChartSerie serie;
               switch (Chart.ChartType)
               {
                   case eChartType.XYScatter:
                   case eChartType.XYScatterLines:
                   case eChartType.XYScatterLinesNoMarkers:
                   case eChartType.XYScatterSmooth:
                   case eChartType.XYScatterSmoothNoMarkers:
                       serie = new ExcelScatterChartSerie(this, NameSpaceManager, ser, _isPivot);
                       break;
                   case eChartType.Pie:
                   case eChartType.Pie3D:
                   case eChartType.PieExploded:
                   case eChartType.PieExploded3D:
                   case eChartType.PieOfPie:
                   case eChartType.Doughnut:
                   case eChartType.DoughnutExploded:
                   case eChartType.BarOfPie:
                       serie = new ExcelPieChartSerie(this, NameSpaceManager, ser, _isPivot);
                       break;
                   case eChartType.Line:
                   case eChartType.LineMarkers:
                   case eChartType.LineMarkersStacked:
                   case eChartType.LineMarkersStacked100:
                   case eChartType.LineStacked:
                   case eChartType.LineStacked100:
                       serie = new ExcelLineChartSerie(this, NameSpaceManager, ser, _isPivot);
                       if (Chart.ChartType == eChartType.LineMarkers ||
                           Chart.ChartType == eChartType.LineMarkersStacked ||
                           Chart.ChartType == eChartType.LineMarkersStacked100)
                       {
                           ((ExcelLineChartSerie)serie).Marker = eMarkerStyle.Square;
                       }
                       ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                       break;

                   default:
                       serie = new ExcelChartSerie(this, NameSpaceManager, ser, _isPivot);
                       break;
               }               
               serie.Series = SeriesAddress;
               serie.XSeries = XSeriesAddress;               
           _list.Add(serie);
               return serie;
        }
Exemple #8
0
 internal protected ExcelChartSerie AddSeries(string SeriesAddress, string XSeriesAddress, string bubbleSizeAddress)
  {
         XmlElement ser = _node.OwnerDocument.CreateElement("ser", ExcelPackage.schemaChart);
         XmlNodeList node = _node.SelectNodes("c:ser", _ns);
         if (node.Count > 0)
         {
             _node.InsertAfter(ser, node[node.Count-1]);
         }
         else
         {
             InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle", ser);
          }
         int idx = FindIndex();
         ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{5}{0}{2}{3}{4}", AddExplosion(Chart.ChartType), idx, AddScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
         ExcelChartSerie serie;
         switch (Chart.ChartType)
         {
             case eChartType.Bubble:
             case eChartType.Bubble3DEffect:
                 serie = new ExcelBubbleChartSerie(this, NameSpaceManager, ser, _isPivot)
                 {
                     Bubble3D=Chart.ChartType==eChartType.Bubble3DEffect,
                     Series = SeriesAddress,
                     XSeries = XSeriesAddress,
                     BubbleSize = bubbleSizeAddress                            
                 };
                 break;
             case eChartType.XYScatter:
             case eChartType.XYScatterLines:
             case eChartType.XYScatterLinesNoMarkers:
             case eChartType.XYScatterSmooth:
             case eChartType.XYScatterSmoothNoMarkers:
                 serie = new ExcelScatterChartSerie(this, NameSpaceManager, ser, _isPivot);
                 break;
             case eChartType.Radar:
             case eChartType.RadarFilled:
             case eChartType.RadarMarkers:
                 serie = new ExcelRadarChartSerie(this, NameSpaceManager, ser, _isPivot);
                 break;
             case eChartType.Surface:
             case eChartType.SurfaceTopView:
             case eChartType.SurfaceTopViewWireframe:
             case eChartType.SurfaceWireframe:
                 serie = new ExcelSurfaceChartSerie(this, NameSpaceManager, ser, _isPivot);
                 break;
             case eChartType.Pie:
             case eChartType.Pie3D:
             case eChartType.PieExploded:
             case eChartType.PieExploded3D:
             case eChartType.PieOfPie:
             case eChartType.Doughnut:
             case eChartType.DoughnutExploded:
             case eChartType.BarOfPie:
                 serie = new ExcelPieChartSerie(this, NameSpaceManager, ser, _isPivot);
                 break;
             case eChartType.Line:
             case eChartType.LineMarkers:
             case eChartType.LineMarkersStacked:
             case eChartType.LineMarkersStacked100:
             case eChartType.LineStacked:
             case eChartType.LineStacked100:
                 serie = new ExcelLineChartSerie(this, NameSpaceManager, ser, _isPivot);
                 if (Chart.ChartType == eChartType.LineMarkers ||
                     Chart.ChartType == eChartType.LineMarkersStacked ||
                     Chart.ChartType == eChartType.LineMarkersStacked100)
                 {
                     ((ExcelLineChartSerie)serie).Marker = eMarkerStyle.Square;
                 }
                 ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                 break;
             case eChartType.BarClustered:
             case eChartType.BarStacked:
             case eChartType.BarStacked100:
             case eChartType.ColumnClustered:
             case eChartType.ColumnStacked:
             case eChartType.ColumnStacked100:
             case eChartType.BarClustered3D:
             case eChartType.BarStacked3D:
             case eChartType.BarStacked1003D:
             case eChartType.ColumnClustered3D:
             case eChartType.ColumnStacked3D:
             case eChartType.ColumnStacked1003D:
             case eChartType.ConeBarClustered:
             case eChartType.ConeBarStacked:
             case eChartType.ConeBarStacked100:
             case eChartType.ConeCol:
             case eChartType.ConeColClustered:
             case eChartType.ConeColStacked:
             case eChartType.ConeColStacked100:
             case eChartType.CylinderBarClustered:
             case eChartType.CylinderBarStacked:
             case eChartType.CylinderBarStacked100:
             case eChartType.CylinderCol:
             case eChartType.CylinderColClustered:
             case eChartType.CylinderColStacked:
             case eChartType.CylinderColStacked100:
             case eChartType.PyramidBarClustered:
             case eChartType.PyramidBarStacked:
             case eChartType.PyramidBarStacked100:
             case eChartType.PyramidCol:
             case eChartType.PyramidColClustered:
             case eChartType.PyramidColStacked:
             case eChartType.PyramidColStacked100:
                 serie = new ExcelBarChartSerie(this, NameSpaceManager, ser, _isPivot);
                 ((ExcelBarChartSerie)serie).InvertIfNegative=false;
                 break;
             default:
                 serie = new ExcelChartSerie(this, NameSpaceManager, ser, _isPivot);
                 break;
         }               
         serie.Series = SeriesAddress;
         serie.XSeries = XSeriesAddress;                     
     _list.Add(serie);
         return serie;
  }
        /// <summary>
        /// Adds a new serie to the chart
        /// </summary>
        /// <param name="SerieAddress">The Y-Axis range</param>
        /// <param name="XSerieAddress">The X-Axis range</param>
        /// <param name="bubbleSizeAddress">Bubble chart size</param>
        /// <returns></returns>
        internal protected T AddSeries(string SerieAddress, string XSerieAddress, string bubbleSizeAddress)
        {
            if (_list.Count == 256)
            {
                throw (new InvalidOperationException("Charts have a maximum of 256 series."));
            }
            XmlElement serElement;

            if (_chart._isChartEx)
            {
                serElement = ExcelChartExSerie.CreateSeriesAndDataElement((ExcelChartEx)_chart, !string.IsNullOrEmpty(XSerieAddress));
            }
            else
            {
                serElement = ExcelChartStandardSerie.CreateSerieElement(_chart);
            }
            ExcelChartSerie serie;

            switch (Chart.ChartType)
            {
            case eChartType.Bubble:
            case eChartType.Bubble3DEffect:
                serie = new ExcelBubbleChartSerie(_chart, _ns, serElement, _isPivot)
                {
                    Bubble3D   = Chart.ChartType == eChartType.Bubble3DEffect,
                    Series     = SerieAddress,
                    XSeries    = XSerieAddress,
                    BubbleSize = bubbleSizeAddress
                };
                break;

            case eChartType.XYScatter:
            case eChartType.XYScatterLines:
            case eChartType.XYScatterLinesNoMarkers:
            case eChartType.XYScatterSmooth:
            case eChartType.XYScatterSmoothNoMarkers:
                serie = new ExcelScatterChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.Radar:
            case eChartType.RadarFilled:
            case eChartType.RadarMarkers:
                serie = new ExcelRadarChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.Surface:
            case eChartType.SurfaceTopView:
            case eChartType.SurfaceTopViewWireframe:
            case eChartType.SurfaceWireframe:
                serie = new ExcelSurfaceChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.Pie:
            case eChartType.Pie3D:
            case eChartType.PieExploded:
            case eChartType.PieExploded3D:
            case eChartType.PieOfPie:
            case eChartType.Doughnut:
            case eChartType.DoughnutExploded:
            case eChartType.BarOfPie:
                serie = new ExcelPieChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.Line:
            case eChartType.LineMarkers:
            case eChartType.LineMarkersStacked:
            case eChartType.LineMarkersStacked100:
            case eChartType.LineStacked:
            case eChartType.LineStacked100:
            case eChartType.Line3D:
                serie = new ExcelLineChartSerie(_chart, _ns, serElement, _isPivot);
                if (Chart.ChartType == eChartType.LineMarkers ||
                    Chart.ChartType == eChartType.LineMarkersStacked ||
                    Chart.ChartType == eChartType.LineMarkersStacked100)
                {
                    ((ExcelLineChartSerie)serie).Marker.Style = eMarkerStyle.Square;
                }
                ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                break;

            case eChartType.BarClustered:
            case eChartType.BarStacked:
            case eChartType.BarStacked100:
            case eChartType.ColumnClustered:
            case eChartType.ColumnStacked:
            case eChartType.ColumnStacked100:
            case eChartType.BarClustered3D:
            case eChartType.BarStacked3D:
            case eChartType.BarStacked1003D:
            case eChartType.Column3D:
            case eChartType.ColumnClustered3D:
            case eChartType.ColumnStacked3D:
            case eChartType.ColumnStacked1003D:
            case eChartType.ConeBarClustered:
            case eChartType.ConeBarStacked:
            case eChartType.ConeBarStacked100:
            case eChartType.ConeCol:
            case eChartType.ConeColClustered:
            case eChartType.ConeColStacked:
            case eChartType.ConeColStacked100:
            case eChartType.CylinderBarClustered:
            case eChartType.CylinderBarStacked:
            case eChartType.CylinderBarStacked100:
            case eChartType.CylinderCol:
            case eChartType.CylinderColClustered:
            case eChartType.CylinderColStacked:
            case eChartType.CylinderColStacked100:
            case eChartType.PyramidBarClustered:
            case eChartType.PyramidBarStacked:
            case eChartType.PyramidBarStacked100:
            case eChartType.PyramidCol:
            case eChartType.PyramidColClustered:
            case eChartType.PyramidColStacked:
            case eChartType.PyramidColStacked100:
                serie = new ExcelBarChartSerie(_chart, _ns, serElement, _isPivot);
                ((ExcelBarChartSerie)serie).InvertIfNegative = false;
                break;

            case eChartType.Area:
            case eChartType.Area3D:
            case eChartType.AreaStacked:
            case eChartType.AreaStacked100:
            case eChartType.AreaStacked1003D:
            case eChartType.AreaStacked3D:
                serie = new ExcelAreaChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.StockHLC:
            case eChartType.StockOHLC:
            case eChartType.StockVHLC:
            case eChartType.StockVOHLC:
                serie = new ExcelStockChartSerie(_chart, _ns, serElement, _isPivot);
                break;

            case eChartType.Treemap:
                serie = new ExcelTreemapChartSerie((ExcelChartEx)_chart, _ns, serElement);
                break;

            case eChartType.BoxWhisker:
                serie = new ExcelBoxWhiskerChartSerie((ExcelChartEx)_chart, _ns, serElement);
                break;

            case eChartType.Histogram:
            case eChartType.Pareto:
                serie = new ExcelHistogramChartSerie((ExcelChartEx)_chart, _ns, serElement);
                if (Chart.ChartType == eChartType.Pareto)
                {
                    ((ExcelHistogramChartSerie)serie).AddParetoLine();
                }
                break;

            case eChartType.RegionMap:
                serie = new ExcelRegionMapChartSerie((ExcelChartEx)_chart, _ns, serElement);
                break;

            case eChartType.Waterfall:
                serie = new ExcelWaterfallChartSerie((ExcelChartEx)_chart, _ns, serElement);
                break;

            case eChartType.Sunburst:
            case eChartType.Funnel:
                serie = new ExcelChartExSerie((ExcelChartEx)_chart, _ns, serElement);
                break;

            default:
                serie = new ExcelChartStandardSerie(_chart, _ns, serElement, _isPivot);
                break;
            }
            serie.Series = SerieAddress;
            if (!string.IsNullOrEmpty(XSerieAddress))
            {
                serie.XSeries = XSerieAddress;
            }
            _list.Add((T)serie);
            if (_chart.StyleManager.StylePart != null && _chart._isChartEx == false)
            {
                _chart.StyleManager.ApplySeries();
            }
            return((T)serie);
        }
Exemple #10
0
        private ExcelChartSerie AddSeries(string SeriesAddress, string XSeriesAddress)
        {
            XmlElement  ser  = _node.OwnerDocument.CreateElement("ser", ExcelPackage.schemaChart);
            XmlNodeList node = _node.SelectNodes("c:ser", _ns);

            if (node.Count > 0)
            {
                _node.InsertAfter(ser, node[node.Count - 1]);
            }
            else
            {
                InserAfter(_node, "c:varyColors,c:grouping,c:barDir,c:scatterStyle", ser);
            }
            int idx = FindIndex();

            ser.InnerXml = string.Format("<c:idx val=\"{1}\" /><c:order val=\"{1}\" /><c:tx><c:strRef><c:f></c:f><c:strCache><c:ptCount val=\"1\" /></c:strCache></c:strRef></c:tx>{5}{0}{2}{3}{4}", AddExplosion(Chart.ChartType), idx, AddScatterPoint(Chart.ChartType), AddAxisNodes(Chart.ChartType), AddSmooth(Chart.ChartType), AddMarker(Chart.ChartType));
            ExcelChartSerie serie;

            switch (Chart.ChartType)
            {
            case eChartType.XYScatter:
            case eChartType.XYScatterLines:
            case eChartType.XYScatterLinesNoMarkers:
            case eChartType.XYScatterSmooth:
            case eChartType.XYScatterSmoothNoMarkers:
                serie = new ExcelScatterChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Pie:
            case eChartType.Pie3D:
            case eChartType.PieExploded:
            case eChartType.PieExploded3D:
            case eChartType.PieOfPie:
            case eChartType.Doughnut:
            case eChartType.DoughnutExploded:
            case eChartType.BarOfPie:
                serie = new ExcelPieChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;

            case eChartType.Line:
            case eChartType.LineMarkers:
            case eChartType.LineMarkersStacked:
            case eChartType.LineMarkersStacked100:
            case eChartType.LineStacked:
            case eChartType.LineStacked100:
                serie = new ExcelLineChartSerie(this, NameSpaceManager, ser, _isPivot);
                if (Chart.ChartType == eChartType.LineMarkers ||
                    Chart.ChartType == eChartType.LineMarkersStacked ||
                    Chart.ChartType == eChartType.LineMarkersStacked100)
                {
                    ((ExcelLineChartSerie)serie).Marker = eMarkerStyle.Square;
                }
                ((ExcelLineChartSerie)serie).Smooth = ((ExcelLineChart)Chart).Smooth;
                break;

            default:
                serie = new ExcelChartSerie(this, NameSpaceManager, ser, _isPivot);
                break;
            }
            serie.Series  = SeriesAddress;
            serie.XSeries = XSeriesAddress;
            _list.Add(serie);
            return(serie);
        }