@@ -46,6 +46,7 @@ public RectangleBarSeries()
4646 // this.LabelFormatString = "{0}-{1},{2}-{3}"; // X0-X1,Y0-Y1
4747 }
4848
49+
4950 /// <summary>
5051 /// Gets or sets the default color of the interior of the rectangles.
5152 /// </summary>
@@ -93,6 +94,10 @@ public OxyColor ActualFillColor
9394 /// </summary>
9495 internal IList < OxyRect > ActualBarRectangles { get ; set ; }
9596
97+ /// <summary>
98+ /// Gets or sets the actual rectangle bar items.
99+ /// </summary>
100+ internal IList < RectangleBarItem > ActualItems { get ; set ; }
96101 /// <summary>
97102 /// Gets the point in the dataset that is nearest the specified point.
98103 /// </summary>
@@ -111,10 +116,10 @@ public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpo
111116 var r = this . ActualBarRectangles [ i ] ;
112117 if ( r . Contains ( point ) )
113118 {
114- double value = ( this . Items [ i ] . Y0 + this . Items [ i ] . Y1 ) / 2 ;
119+ double value = ( this . ActualItems [ i ] . Y0 + this . ActualItems [ i ] . Y1 ) / 2 ;
115120 var sp = point ;
116121 var dp = new DataPoint ( i , value ) ;
117- var item = this . GetItem ( i ) ;
122+ var item = this . ActualItems [ i ] ;
118123 return new TrackerHitResult
119124 {
120125 Series = this ,
@@ -123,17 +128,17 @@ public override TrackerHitResult GetNearestPoint(ScreenPoint point, bool interpo
123128 Item = item ,
124129 Index = i ,
125130 Text = StringHelper . Format (
126- this . ActualCulture ,
131+ this . ActualCulture ,
127132 this . TrackerFormatString ,
128133 item ,
129134 this . Title ,
130135 this . XAxis . Title ?? DefaultXAxisTitle ,
131- this . XAxis . GetValue ( this . Items [ i ] . X0 ) ,
132- this . XAxis . GetValue ( this . Items [ i ] . X1 ) ,
136+ this . XAxis . GetValue ( this . ActualItems [ i ] . X0 ) ,
137+ this . XAxis . GetValue ( this . ActualItems [ i ] . X1 ) ,
133138 this . YAxis . Title ?? DefaultYAxisTitle ,
134- this . YAxis . GetValue ( this . Items [ i ] . Y0 ) ,
135- this . YAxis . GetValue ( this . Items [ i ] . Y1 ) ,
136- this . Items [ i ] . Title )
139+ this . YAxis . GetValue ( this . ActualItems [ i ] . Y0 ) ,
140+ this . YAxis . GetValue ( this . ActualItems [ i ] . Y1 ) ,
141+ this . ActualItems [ i ] . Title )
137142 } ;
138143 }
139144 }
@@ -158,6 +163,7 @@ public override void Render(IRenderContext rc)
158163 double xmax = double . MaxValue ;
159164
160165 this . ActualBarRectangles = new List < OxyRect > ( ) ;
166+ this . ActualItems = new List < RectangleBarItem > ( ) ;
161167
162168 if ( this . IsXMonotonic )
163169 {
@@ -169,8 +175,7 @@ public override void Render(IRenderContext rc)
169175 }
170176
171177 int clipCount = 0 ;
172- for ( int i = startIdx ; i < this . Items . Count ; i ++ )
173- {
178+ for ( int i = startIdx ; i < this . Items . Count ; i ++ ) {
174179 var item = this . Items [ i ] ;
175180 if ( ! this . IsValid ( item . X0 ) || ! this . IsValid ( item . X1 )
176181 || ! this . IsValid ( item . Y0 ) || ! this . IsValid ( item . Y1 ) )
@@ -184,6 +189,7 @@ public override void Render(IRenderContext rc)
184189 var rectangle = OxyRect . Create ( p0 . X , p0 . Y , p1 . X , p1 . Y ) ;
185190
186191 this . ActualBarRectangles . Add ( rectangle ) ;
192+ this . ActualItems . Add ( item ) ;
187193
188194 rc . DrawClippedRectangleAsPolygon (
189195 clippingRect ,
@@ -331,4 +337,4 @@ protected virtual bool IsValid(double v)
331337 return ! double . IsNaN ( v ) && ! double . IsInfinity ( v ) ;
332338 }
333339 }
334- }
340+ }
0 commit comments