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 ExcelBarChart(ExcelDrawings drawings, XmlNode node) : // base(drawings, node/*, 1*/) //{ // SetChartNodeText(""); //} //internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type) : // base(drawings, node, type) //{ // SetChartNodeText(""); // SetTypeProperties(drawings, type); //} internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { SetChartNodeText(""); SetTypeProperties(drawings, type); }
internal ExcelBubbleChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { ShowNegativeBubbles = false; BubbleScale = 100; _chartSeries = new ExcelBubbleChartSeries(this, drawings.NameSpaceManager, _chartNode, PivotTableSource!=null); //SetTypeProperties(); }
internal ExcelChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node) : base(ns,node) { _ns = ns; _chart=chart; _node=node; foreach(XmlNode n in node.SelectNodes("//c:ser",ns)) { ExcelChartSerie s = new ExcelChartSerie(this, ns, n); _list.Add(s); } }
internal ExcelLineChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { // _chartTopPath = string.Format(_chartTopPath, chartNode.Name); }
internal static ExcelChart GetChart(XmlElement chartNode, ExcelDrawings drawings, XmlNode node, Uri uriChart, Packaging.ZipPackagePart part, XmlDocument chartXml, ExcelChart topChart) { switch (chartNode.LocalName) { case "area3DChart": case "areaChart": case "stockChart": if (topChart == null) { return new ExcelChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelChart(topChart, chartNode); } case "surface3DChart": case "surfaceChart": if (topChart == null) { return new ExcelSurfaceChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelSurfaceChart(topChart, chartNode); } case "radarChart": if (topChart == null) { return new ExcelRadarChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelRadarChart(topChart, chartNode); } case "bubbleChart": if (topChart == null) { return new ExcelBubbleChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelBubbleChart(topChart, chartNode); } case "barChart": case "bar3DChart": if (topChart == null) { return new ExcelBarChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelBarChart(topChart, chartNode); } case "doughnutChart": if (topChart == null) { return new ExcelDoughnutChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelDoughnutChart(topChart, chartNode); } case "pie3DChart": case "pieChart": if (topChart == null) { return new ExcelPieChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelPieChart(topChart, chartNode); } case "ofPieChart": if (topChart == null) { return new ExcelOfPieChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelBarChart(topChart, chartNode); } case "lineChart": case "line3DChart": if (topChart == null) { return new ExcelLineChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelLineChart(topChart, chartNode); } case "scatterChart": if (topChart == null) { return new ExcelScatterChart(drawings, node, uriChart, part, chartXml, chartNode); } else { return new ExcelScatterChart(topChart, chartNode); } default: return null; } }
internal ExcelChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name") { ChartType = type; CreateNewChart(drawings, type, topChart); Init(drawings, _chartNode); _chartSeries = new ExcelChartSeries(this, drawings.NameSpaceManager, _chartNode, PivotTableSource!=null); if (PivotTableSource != null) SetPivotSource(PivotTableSource); SetTypeProperties(); if (topChart == null) LoadAxis(); else { _axis = topChart.Axis; if (_axis.Length > 0) { XAxis = _axis[0]; YAxis = _axis[1]; } } }
internal ExcelChartLegend(XmlNamespaceManager ns, XmlNode node, ExcelChart chart) : base(ns,node) { _chart=chart; SchemaNodeOrder = new string[] { "legendPos", "layout","overlay", "txPr", "bodyPr", "lstStyle", "spPr" }; }
internal ExcelChartSerieDataLabel(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, string[] schemaNodeOrder) : base(chart, ns, node, "dLbls", schemaNodeOrder) { Position = eLabelPosition.Center; }
internal ExcelScatterChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { SetTypeProperties(); }
internal ExcelChartMarker(ExcelChart chart, XmlNamespaceManager ns, XmlNode topNode, string[] schemaNodeOrder) : base(ns, topNode) { AddSchemaNodeOrder(schemaNodeOrder, new string[] { "symbol", "size", "spPr" }); _chart = chart; _allowMarkers = chart.IsType3D(); }
internal ExcelBubbleChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot) : base(chart, ns, node, isPivot) { //_chartSeries = new ExcelChartSeries(this, _drawings.NameSpaceManager, _chartNode, isPivot); }
internal static ExcelChart GetNewChart(ExcelDrawings drawings, XmlNode drawNode, eChartType chartType, ExcelChart topChart) { switch(chartType) { case eChartType.Pie: case eChartType.PieExploded: case eChartType.Pie3D: case eChartType.PieExploded3D: return new ExcelPieChart(drawings, drawNode, chartType, topChart); case eChartType.BarOfPie: case eChartType.PieOfPie: return new ExcelOfPieChart(drawings, drawNode, chartType, topChart); case eChartType.Doughnut: case eChartType.DoughnutExploded: return new ExcelDoughnutChart(drawings, drawNode, chartType, topChart); case eChartType.BarClustered: case eChartType.BarStacked: case eChartType.BarStacked100: case eChartType.BarClustered3D: case eChartType.BarStacked3D: case eChartType.BarStacked1003D: case eChartType.ConeBarClustered: case eChartType.ConeBarStacked: case eChartType.ConeBarStacked100: case eChartType.CylinderBarClustered: case eChartType.CylinderBarStacked: case eChartType.CylinderBarStacked100: case eChartType.PyramidBarClustered: case eChartType.PyramidBarStacked: case eChartType.PyramidBarStacked100: case eChartType.ColumnClustered: case eChartType.ColumnStacked: case eChartType.ColumnStacked100: case eChartType.Column3D: case eChartType.ColumnClustered3D: case eChartType.ColumnStacked3D: case eChartType.ColumnStacked1003D: case eChartType.ConeCol: case eChartType.ConeColClustered: case eChartType.ConeColStacked: case eChartType.ConeColStacked100: case eChartType.CylinderCol: case eChartType.CylinderColClustered: case eChartType.CylinderColStacked: case eChartType.CylinderColStacked100: case eChartType.PyramidCol: case eChartType.PyramidColClustered: case eChartType.PyramidColStacked: case eChartType.PyramidColStacked100: return new ExcelBarChart(drawings, drawNode, chartType, topChart); case eChartType.XYScatter: case eChartType.XYScatterLines: case eChartType.XYScatterLinesNoMarkers: case eChartType.XYScatterSmooth: case eChartType.XYScatterSmoothNoMarkers: return new ExcelScatterChart(drawings, drawNode, chartType, topChart); case eChartType.Line: case eChartType.Line3D: case eChartType.LineMarkers: case eChartType.LineMarkersStacked: case eChartType.LineMarkersStacked100: case eChartType.LineStacked: case eChartType.LineStacked100: return new ExcelLineChart(drawings, drawNode, chartType, topChart); default: return new ExcelChart(drawings, drawNode, chartType, topChart); } }
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); } }
internal ExcelSurfaceChart(ExcelChart topChart, XmlNode chartNode, ExcelGroupShape parent = null) : base(topChart, chartNode, parent) { Init(); }
internal ExcelSurfaceChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { Init(); }
internal ExcelSurfaceChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { Init(); }
internal ExcelDoughnutChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { //SetPaths(); }
internal ExcelBarChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { SetChartNodeText(chartNode.Name); }
internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { SetTypeProperties(); }
internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { //SetPaths(); }
internal ExcelDoughnutChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart) : base(drawings, node, type, topChart) { //SetPaths(); }
internal ExcelScatterChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart) : base(drawings, node, type, topChart) { SetTypeProperties(); }
public ExcelDoughnutChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { //SetPaths(); }
internal ExcelBubbleChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { _chartSeries = new ExcelBubbleChartSeries(this, _drawings.NameSpaceManager, _chartNode, false); }
internal ExcelChartPlotArea(XmlNamespaceManager ns, XmlNode node, ExcelChart firstChart) : base(ns,node) { _firstChart = firstChart; }
internal ExcelChartLegend(XmlNamespaceManager ns, XmlNode node, ExcelChart chart) : base(ns,node) { _chart=chart; }
private void CreateNewChart(ExcelDrawings drawings, eChartType type, ExcelChart topChart) { if (topChart == null) { XmlElement graphFrame = TopNode.OwnerDocument.CreateElement("graphicFrame", ExcelPackage.schemaSheetDrawings); graphFrame.SetAttribute("macro", ""); TopNode.AppendChild(graphFrame); graphFrame.InnerXml = string.Format("<xdr:nvGraphicFramePr><xdr:cNvPr id=\"{0}\" name=\"Chart 1\" /><xdr:cNvGraphicFramePr /></xdr:nvGraphicFramePr><xdr:xfrm><a:off x=\"0\" y=\"0\" /> <a:ext cx=\"0\" cy=\"0\" /></xdr:xfrm><a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/chart\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" r:id=\"rId1\" /> </a:graphicData> </a:graphic>",_id); TopNode.AppendChild(TopNode.OwnerDocument.CreateElement("clientData", ExcelPackage.schemaSheetDrawings)); var package = drawings.Worksheet._package.Package; UriChart = GetNewUri(package, "/xl/charts/chart{0}.xml"); ChartXml = new XmlDocument(); ChartXml.PreserveWhitespace = ExcelPackage.preserveWhitespace; LoadXmlSafe(ChartXml, ChartStartXml(type), Encoding.UTF8); // save it to the package Part = package.CreatePart(UriChart, "application/vnd.openxmlformats-officedocument.drawingml.chart+xml", _drawings._package.Compression); StreamWriter streamChart = new StreamWriter(Part.GetStream(FileMode.Create, FileAccess.Write)); ChartXml.Save(streamChart); streamChart.Close(); package.Flush(); var chartRelation = drawings.Part.CreateRelationship(UriHelper.GetRelativeUri(drawings.UriDrawing, UriChart), Packaging.TargetMode.Internal, ExcelPackage.schemaRelationships + "/chart"); graphFrame.SelectSingleNode("a:graphic/a:graphicData/c:chart", NameSpaceManager).Attributes["r:id"].Value = chartRelation.Id; package.Flush(); _chartNode = ChartXml.SelectSingleNode(string.Format("c:chartSpace/c:chart/c:plotArea/{0}", GetChartNodeText()), NameSpaceManager); } else { ChartXml = topChart.ChartXml; Part = topChart.Part; _plotArea = topChart.PlotArea; UriChart = topChart.UriChart; _axis = topChart._axis; XmlNode preNode = _plotArea.ChartTypes[_plotArea.ChartTypes.Count - 1].ChartNode; _chartNode = ((XmlDocument)ChartXml).CreateElement(GetChartNodeText(), ExcelPackage.schemaChart); preNode.ParentNode.InsertAfter(_chartNode, preNode); if (topChart.Axis.Length == 0) { AddAxis(); } string serieXML = GetChartSerieStartXml(type, int.Parse(topChart.Axis[0].Id), int.Parse(topChart.Axis[1].Id), topChart.Axis.Length>2?int.Parse(topChart.Axis[2].Id) : -1); _chartNode.InnerXml = serieXML; } }
internal ExcelBubbleChartSeries(ExcelChart chart, XmlNamespaceManager ns, XmlNode node, bool isPivot) : base(chart,ns,node, isPivot) { //_chartSeries = new ExcelChartSeries(this, _drawings.NameSpaceManager, _chartNode, isPivot); }
internal ExcelChart(ExcelChart topChart, XmlNode chartNode) : base(topChart._drawings, topChart.TopNode, "xdr:graphicFrame/xdr:nvGraphicFramePr/xdr:cNvPr/@name") { UriChart = topChart.UriChart; Part = topChart.Part; ChartXml = topChart.ChartXml; _plotArea = topChart.PlotArea; _chartNode = chartNode; InitChartLoad(topChart._drawings, chartNode); }
internal ExcelPieChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { }
internal static ExcelChart GetNewChart(ExcelDrawings drawings, XmlNode drawNode, eChartType chartType, ExcelChart topChart, ExcelPivotTable PivotTableSource) { switch(chartType) { case eChartType.Pie: case eChartType.PieExploded: case eChartType.Pie3D: case eChartType.PieExploded3D: return new ExcelPieChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.BarOfPie: case eChartType.PieOfPie: return new ExcelOfPieChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.Doughnut: case eChartType.DoughnutExploded: return new ExcelDoughnutChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.BarClustered: case eChartType.BarStacked: case eChartType.BarStacked100: case eChartType.BarClustered3D: case eChartType.BarStacked3D: case eChartType.BarStacked1003D: case eChartType.ConeBarClustered: case eChartType.ConeBarStacked: case eChartType.ConeBarStacked100: case eChartType.CylinderBarClustered: case eChartType.CylinderBarStacked: case eChartType.CylinderBarStacked100: case eChartType.PyramidBarClustered: case eChartType.PyramidBarStacked: case eChartType.PyramidBarStacked100: case eChartType.ColumnClustered: case eChartType.ColumnStacked: case eChartType.ColumnStacked100: case eChartType.Column3D: case eChartType.ColumnClustered3D: case eChartType.ColumnStacked3D: case eChartType.ColumnStacked1003D: case eChartType.ConeCol: case eChartType.ConeColClustered: case eChartType.ConeColStacked: case eChartType.ConeColStacked100: case eChartType.CylinderCol: case eChartType.CylinderColClustered: case eChartType.CylinderColStacked: case eChartType.CylinderColStacked100: case eChartType.PyramidCol: case eChartType.PyramidColClustered: case eChartType.PyramidColStacked: case eChartType.PyramidColStacked100: return new ExcelBarChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.XYScatter: case eChartType.XYScatterLines: case eChartType.XYScatterLinesNoMarkers: case eChartType.XYScatterSmooth: case eChartType.XYScatterSmoothNoMarkers: return new ExcelScatterChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.Line: case eChartType.Line3D: case eChartType.LineMarkers: case eChartType.LineMarkersStacked: case eChartType.LineMarkersStacked100: case eChartType.LineStacked: case eChartType.LineStacked100: return new ExcelLineChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.Bubble: case eChartType.Bubble3DEffect: return new ExcelBubbleChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.Radar: case eChartType.RadarFilled: case eChartType.RadarMarkers: return new ExcelRadarChart(drawings, drawNode, chartType, topChart, PivotTableSource); case eChartType.Surface: case eChartType.SurfaceTopView: case eChartType.SurfaceTopViewWireframe: case eChartType.SurfaceWireframe: return new ExcelSurfaceChart(drawings, drawNode, chartType, topChart, PivotTableSource); default: return new ExcelChart(drawings, drawNode, chartType, topChart, PivotTableSource); } }
internal ExcelPieChart(ExcelChart topChart, XmlNode chartNode) : base(topChart, chartNode) { }
internal ExcelLineChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart, ExcelPivotTable PivotTableSource) : base(drawings, node, type, topChart, PivotTableSource) { //_chartTopPath = string.Format(_chartTopPath, GetChartNodeText()); }