Skip to content

Commit 8da8bda

Browse files
author
JanKallman
committed
Added support for different chart types series on the same chart... PlotArea.ChartTypes collection to add new ChartTypes. Added support for Secondary Axis and a lot of new Axis properties.Style property to ExcelChart for build-in styles. New method to LoadFromText-method added to ExcelRange to import csv files. Fixed table bugs (Thanks Miles).
Only bug-fixes from now on until the next version. --HG-- extra : convert_revision : svn%3Ac031521d-7fdb-604e-9ef1-0138de3cd895/trunk%4052
1 parent 7ac3b2e commit 8da8bda

31 files changed

+2106
-411
lines changed

ExcelPackage/Drawing/Chart/ExcelBarChart.cs

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,49 @@ namespace OfficeOpenXml.Drawing.Chart
4141
public sealed class ExcelBarChart : ExcelChart
4242
{
4343
#region "Constructors"
44-
internal ExcelBarChart(ExcelDrawings drawings, XmlNode node) :
45-
base(drawings, node)
44+
//internal ExcelBarChart(ExcelDrawings drawings, XmlNode node) :
45+
// base(drawings, node/*, 1*/)
46+
//{
47+
// SetChartNodeText("");
48+
//}
49+
//internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type) :
50+
// base(drawings, node, type)
51+
//{
52+
// SetChartNodeText("");
53+
54+
// SetTypeProperties(drawings, type);
55+
//}
56+
internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type, ExcelChart topChart) :
57+
base(drawings, node, type, topChart)
4658
{
47-
SetChartNodeText();
59+
SetChartNodeText("");
60+
61+
SetTypeProperties(drawings, type);
4862
}
49-
internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, eChartType type) :
50-
base(drawings, node, type)
63+
64+
internal ExcelBarChart(ExcelDrawings drawings, XmlNode node, Uri uriChart, System.IO.Packaging.PackagePart part, XmlDocument chartXml, XmlNode chartNode) :
65+
base(drawings, node, uriChart, part, chartXml, chartNode)
5166
{
52-
SetChartNodeText();
67+
SetChartNodeText(chartNode.Name);
68+
}
5369

54-
SetTypeProperties(drawings, type);
70+
internal ExcelBarChart(ExcelChart topChart, XmlNode chartNode) :
71+
base(topChart, chartNode)
72+
{
73+
SetChartNodeText(chartNode.Name);
5574
}
5675
#endregion
5776
#region "Private functions"
58-
string _chartTopPath="c:chartSpace/c:chart/c:plotArea/{0}";
59-
private void SetChartNodeText()
77+
//string _chartTopPath="c:chartSpace/c:chart/c:plotArea/{0}";
78+
private void SetChartNodeText(string chartNodeText)
6079
{
61-
string text = GetChartNodeText();
62-
_chartTopPath=string.Format(_chartTopPath, text);
63-
_directionPath = string.Format(_directionPath, _chartTopPath);
64-
_shapePath = string.Format(_shapePath, _chartTopPath);
80+
if(string.IsNullOrEmpty(chartNodeText))
81+
{
82+
chartNodeText = GetChartNodeText();
83+
}
84+
//_chartTopPath = string.Format(_chartTopPath, chartNodeText);
85+
//_directionPath = string.Format(_directionPath, _chartTopPath);
86+
//_shapePath = string.Format(_shapePath, _chartTopPath);
6587
}
6688
private void SetTypeProperties(ExcelDrawings drawings, eChartType type)
6789
{
@@ -161,7 +183,7 @@ private void SetTypeProperties(ExcelDrawings drawings, eChartType type)
161183
}
162184
#endregion
163185
#region "Properties"
164-
string _directionPath = "{0}/c:barDir/@val";
186+
string _directionPath = "c:barDir/@val";
165187
public eDirection Direction
166188
{
167189
get
@@ -173,7 +195,7 @@ internal set
173195
_chartXmlHelper.SetXmlNodeString(_directionPath, GetDirectionText(value));
174196
}
175197
}
176-
string _shapePath = "{0}/c:shape/@val";
198+
string _shapePath = "c:shape/@val";
177199
public eShape Shape
178200
{
179201
get
@@ -186,13 +208,16 @@ internal set
186208
}
187209
}
188210
ExcelChartDataLabel _DataLabel = null;
211+
private ExcelDrawings drawings;
212+
private XmlNode node;
213+
private ExcelChart topChart;
189214
public ExcelChartDataLabel DataLabel
190215
{
191216
get
192217
{
193218
if (_DataLabel == null)
194219
{
195-
_DataLabel = new ExcelChartDataLabel(NameSpaceManager, _chartXmlHelper.TopNode.SelectSingleNode(_chartTopPath, NameSpaceManager));
220+
_DataLabel = new ExcelChartDataLabel(NameSpaceManager, ChartNode);
196221
}
197222
return _DataLabel;
198223
}

0 commit comments

Comments
 (0)