@@ -41,27 +41,49 @@ namespace OfficeOpenXml.Drawing.Chart
41
41
public sealed class ExcelBarChart : ExcelChart
42
42
{
43
43
#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 )
46
58
{
47
- SetChartNodeText ( ) ;
59
+ SetChartNodeText ( "" ) ;
60
+
61
+ SetTypeProperties ( drawings , type ) ;
48
62
}
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 )
51
66
{
52
- SetChartNodeText ( ) ;
67
+ SetChartNodeText ( chartNode . Name ) ;
68
+ }
53
69
54
- SetTypeProperties ( drawings , type ) ;
70
+ internal ExcelBarChart ( ExcelChart topChart , XmlNode chartNode ) :
71
+ base ( topChart , chartNode )
72
+ {
73
+ SetChartNodeText ( chartNode . Name ) ;
55
74
}
56
75
#endregion
57
76
#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 )
60
79
{
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);
65
87
}
66
88
private void SetTypeProperties ( ExcelDrawings drawings , eChartType type )
67
89
{
@@ -161,7 +183,7 @@ private void SetTypeProperties(ExcelDrawings drawings, eChartType type)
161
183
}
162
184
#endregion
163
185
#region "Properties"
164
- string _directionPath = "{0}/ c:barDir/@val" ;
186
+ string _directionPath = "c:barDir/@val" ;
165
187
public eDirection Direction
166
188
{
167
189
get
@@ -173,7 +195,7 @@ internal set
173
195
_chartXmlHelper . SetXmlNodeString ( _directionPath , GetDirectionText ( value ) ) ;
174
196
}
175
197
}
176
- string _shapePath = "{0}/ c:shape/@val" ;
198
+ string _shapePath = "c:shape/@val" ;
177
199
public eShape Shape
178
200
{
179
201
get
@@ -186,13 +208,16 @@ internal set
186
208
}
187
209
}
188
210
ExcelChartDataLabel _DataLabel = null ;
211
+ private ExcelDrawings drawings ;
212
+ private XmlNode node ;
213
+ private ExcelChart topChart ;
189
214
public ExcelChartDataLabel DataLabel
190
215
{
191
216
get
192
217
{
193
218
if ( _DataLabel == null )
194
219
{
195
- _DataLabel = new ExcelChartDataLabel ( NameSpaceManager , _chartXmlHelper . TopNode . SelectSingleNode ( _chartTopPath , NameSpaceManager ) ) ;
220
+ _DataLabel = new ExcelChartDataLabel ( NameSpaceManager , ChartNode ) ;
196
221
}
197
222
return _DataLabel ;
198
223
}
0 commit comments