Example #1
0
        internal ExcelChartTrendline(XmlNamespaceManager namespaceManager, XmlNode topNode, ExcelChartStandardSerie serie) :
            base(namespaceManager, topNode)

        {
            _serie = serie;
            AddSchemaNodeOrder(new string[] { "name", "spPr", "trendlineType", "order", "period", "forward", "backward", "intercept", "dispRSqr", "dispEq", "trendlineLbl" }, ExcelDrawing._schemaNodeOrderSpPr);
        }
Example #2
0
        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);
            }
        }
 internal ExcelChartTrendlineCollection(ExcelChartStandardSerie serie)
 {
     _serie = serie;
     if (serie != null)
     {
         foreach (XmlNode node in _serie.TopNode.SelectNodes("c:trendline", _serie.NameSpaceManager))
         {
             _list.Add(new ExcelChartTrendline(_serie.NameSpaceManager, node, serie));
         }
     }
 }
        internal ExcelChartTrendlineLabel(XmlNamespaceManager namespaceManager, XmlNode topNode, ExcelChartStandardSerie serie) : base(namespaceManager, topNode)
        {
            _serie = serie;

            AddSchemaNodeOrder(new string[] { "layout", "tx", "numFmt", "spPr", "txPr" }, ExcelDrawing._schemaNodeOrderSpPr);
        }
Example #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 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);
        }