Skip to content

Commit e4829c7

Browse files
authored
Bug/issue2220 (#2221)
* Fixed issue #2218 * Fixes issue #2220
1 parent ba4aefc commit e4829c7

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/EPPlus/Drawing/Chart/ExcelChartStandard.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal ExcelChartStandard(ExcelDrawings drawings, XmlNode node, Uri uriChart,
8080
base(drawings, node, chartXml, parent, drawingPath, nvPrPath)
8181
{
8282
var originalPtSource = _chartXmlHelper.GetXmlNodeString("c:pivotSource/c:name");
83-
if (!string.IsNullOrEmpty(originalPtSource))
83+
if(!string.IsNullOrEmpty(originalPtSource))
8484
{
8585
var ptSource = originalPtSource;
8686
if (ptSource.StartsWith("["))
@@ -113,6 +113,7 @@ internal ExcelChartStandard(ExcelChart topChart, XmlNode chartNode, ExcelGroupSh
113113
_plotArea = topChart.PlotArea;
114114
_chartNode = chartNode;
115115
InitChartLoad(topChart._drawings, chartNode, false);
116+
ChartType = GetChartType(chartNode.LocalName);
116117
}
117118
private void InitChartLoad(ExcelDrawings drawings, XmlNode chartNode, bool isPivot)
118119
{

src/EPPlus/Drawing/Chart/Style/ExcelChartStyleManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,12 +684,12 @@ private void ApplyAxis()
684684
}
685685

686686
internal void ApplySeries()
687-
{
687+
{
688+
int serieNo = 0;
688689
foreach (var chart in _chart.PlotArea.ChartTypes)
689690
{
690691
var dataPoint = GetDataPointStyle(chart);
691692
var applyFill = (!chart.IsTypeLine() || chart.ChartType == eChartType.Line3D || chart.ChartType == eChartType.XYScatter); //Lines have no fill, except Line3D
692-
int serieNo = 0;
693693
foreach (ExcelChartSerie serie in chart.Series)
694694
{
695695
//Note: Datalabels are applied in the ApplyDataLabels method

src/EPPlusTest/Drawing/Chart/SeriesTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ public void ChartSeriesLitStringYNumX()
118118
{
119119
var ws = p.Workbook.Worksheets.Add("InvalidStrLit");
120120
var lineChart = ws.Drawings.AddLineChart("LineChart1", OfficeOpenXml.Drawing.Chart.eLineChartType.Line);
121-
var serie = lineChart.Series.Add("{\"Label1\",\"Label 2\",\"Something else\"}", "{120.3,14,5000.0005}");
122-
121+
var serie = lineChart.Series.Add("{\"Label1\",\"Label 2\",\"Something else\"}", "{120.3,14,5000.0005}");
123122
}
124123
}
125124
}

src/EPPlusTest/Issues/ChartIssues.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,5 +414,20 @@ public void CreateStringLiterals()
414414
SaveAndCleanup(package);
415415
}
416416
}
417+
[TestMethod]
418+
public void s981()
419+
{
420+
using (var package = OpenTemplatePackage("s981.xlsx"))
421+
{
422+
var wb = package.Workbook;
423+
var ws = wb.Worksheets["Summary"];
424+
425+
var chart = ws.Drawings[0].As.Chart.ScatterChart;
426+
427+
chart.StyleManager.SetChartStyle(ePresetChartStyleMultiSeries.ScatterChartStyle3);
428+
429+
SaveAndCleanup(package);
430+
}
431+
}
417432
}
418433
}

0 commit comments

Comments
 (0)