@@ -212,10 +212,13 @@ private XYItemSelection getMinMaxClosestSelection(ChartItem item, int viewX,
212
212
if (bounds .isEmpty ()) return null ;
213
213
214
214
int [][] visibleBounds = contx .getVisibleBounds (bounds );
215
+ if (visibleBounds [0 ][0 ] == -1 && visibleBounds [0 ][1 ] == -1 &&
216
+ visibleBounds [1 ][0 ] == -1 && visibleBounds [1 ][1 ] == -1 )
217
+ return null ;
215
218
216
219
int firstVisible = visibleBounds [0 ][0 ];
217
220
if (firstVisible == -1 ) firstVisible = visibleBounds [0 ][1 ];
218
- if (firstVisible == -1 ) return null ;
221
+ if (firstVisible == -1 ) firstVisible = 0 ;
219
222
220
223
int lastVisible = visibleBounds [1 ][0 ];
221
224
if (lastVisible == -1 ) lastVisible = visibleBounds [1 ][1 ];
@@ -314,15 +317,16 @@ private int[][] getMinMaxPoints(XYItem item, Rectangle dirtyArea,
314
317
315
318
dirtyArea .grow (lineWidth , lineWidth );
316
319
int [][] visibleBounds = context .getVisibleBounds (dirtyArea );
320
+ if (visibleBounds [0 ][0 ] == -1 && visibleBounds [0 ][1 ] == -1 &&
321
+ visibleBounds [1 ][0 ] == -1 && visibleBounds [1 ][1 ] == -1 )
322
+ return null ;
317
323
318
- int firstFirst = visibleBounds [0 ][0 ];
319
- int firstIndex = firstFirst ;
324
+ int firstIndex = visibleBounds [0 ][0 ];
320
325
if (firstIndex == -1 ) firstIndex = visibleBounds [0 ][1 ];
321
- if (firstIndex == -1 ) return null ;
326
+ if (firstIndex == -1 ) firstIndex = 0 ;
322
327
323
328
int valuesCount = item .getValuesCount ();
324
- int lastFirst = visibleBounds [1 ][0 ];
325
- int lastIndex = lastFirst ;
329
+ int lastIndex = visibleBounds [1 ][0 ];
326
330
if (lastIndex == -1 ) lastIndex = visibleBounds [1 ][1 ];
327
331
if (lastIndex == -1 ) lastIndex = valuesCount - 1 ;
328
332
0 commit comments