@@ -1762,7 +1762,7 @@ public static PlotModel Smooth()
17621762 var model = new PlotModel { Title = "LineSeries with Smooth = true (zoomed in)" } ;
17631763 var l = new Legend
17641764 {
1765- LegendSymbolLength = 24
1765+ LegendSymbolLength = 24
17661766 } ;
17671767
17681768 model . Legends . Add ( l ) ;
@@ -2290,9 +2290,9 @@ public static PlotModel EmojiText()
22902290 public static PlotModel FindWindowsStartIndex ( )
22912291 {
22922292 var plotModel1 = new PlotModel { Title = "AreaSeries broken in time" } ;
2293- var axis = new LinearAxis { Position = AxisPosition . Left , MinimumPadding = 0 , MaximumPadding = 0.06 , AbsoluteMinimum = 0 } ;
2294- var xAxis = new LinearAxis ( ) { Position = AxisPosition . Bottom , Minimum = 4 } ;
2295-
2293+ var axis = new LinearAxis { Position = AxisPosition . Left , MinimumPadding = 0 , MaximumPadding = 0.06 , AbsoluteMinimum = 0 } ;
2294+ var xAxis = new LinearAxis ( ) { Position = AxisPosition . Bottom , Minimum = 4 } ;
2295+
22962296 plotModel1 . Axes . Add ( axis ) ;
22972297 plotModel1 . Axes . Add ( xAxis ) ;
22982298
@@ -2307,14 +2307,14 @@ public static PlotModel FindWindowsStartIndex()
23072307 areaSeries . Points . Add ( DataPoint . Undefined ) ;
23082308 areaSeries . Points2 . Add ( DataPoint . Undefined ) ;
23092309 }
2310-
2310+
23112311 currentValue += random . NextDouble ( ) ;
23122312 areaSeries . Points . Add ( new DataPoint ( currentValue , currentValue ) ) ;
23132313 areaSeries . Points2 . Add ( new DataPoint ( currentValue , currentValue ) ) ;
23142314 }
2315-
2315+
23162316 plotModel1 . Series . Add ( areaSeries ) ;
2317-
2317+
23182318
23192319 return plotModel1 ;
23202320 }
@@ -2567,6 +2567,38 @@ public DataPoint GetDataPoint()
25672567 }
25682568 }
25692569
2570+ [ Example ( "#2038 BarSeries: HitTest does not deliver the correct BarItem (Closed)" ) ]
2571+ public static PlotModel BarSeriesHitTestBug2038 ( )
2572+ {
2573+ var model = new PlotModel
2574+ {
2575+ Title = "#2038 HitTest does not deliver the correct BarItem, when there are invalid items in Data" ,
2576+ Subtitle = "Click on top item, the top item, should change color!"
2577+ } ;
2578+ model . MouseDown += ( s , e ) =>
2579+ {
2580+ if ( e . ChangedButton == OxyMouseButton . Left )
2581+ {
2582+ foreach ( var hit in model . HitTest ( new HitTestArguments ( e . Position , 0 ) ) )
2583+ {
2584+ if ( hit . Item is BarItem barItem )
2585+ {
2586+ barItem . Color = OxyColors . Red ;
2587+ model . InvalidatePlot ( false ) ;
2588+ }
2589+ }
2590+ }
2591+ } ;
2592+ var s1 = new BarSeries { Title = "Series 1" , IsStacked = true , StrokeColor = OxyColors . Black , StrokeThickness = 1 , StackGroup = "3" } ;
2593+ int i = 0 ;
2594+ s1 . Items . Add ( new BarItem { Value = 25 , CategoryIndex = i ++ } ) ;
2595+ s1 . Items . Add ( new BarItem { Value = double . NaN , CategoryIndex = i ++ } ) ;
2596+ s1 . Items . Add ( new BarItem { Value = 18 , CategoryIndex = i ++ } ) ;
2597+ s1 . Items . Add ( new BarItem { Value = 40 , CategoryIndex = i ++ } ) ;
2598+ model . Series . Add ( s1 ) ;
2599+ return model ;
2600+ }
2601+
25702602 /* NEW ISSUE TEMPLATE
25712603 [Example("#123: Issue Description")]
25722604 public static PlotModel IssueDescription()
0 commit comments