Skip to content

Commit 146ef02

Browse files
jisedlacthurka
authored andcommitted
Workaround for missing parts of chart when scrolling to its left end.
1 parent 05fac95 commit 146ef02

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

visualvm/charts/src/com/sun/tools/visualvm/charts/xy/XYPainter.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ private XYItemSelection getMinMaxClosestSelection(ChartItem item, int viewX,
212212
if (bounds.isEmpty()) return null;
213213

214214
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;
215218

216219
int firstVisible = visibleBounds[0][0];
217220
if (firstVisible == -1) firstVisible = visibleBounds[0][1];
218-
if (firstVisible == -1) return null;
221+
if (firstVisible == -1) firstVisible = 0;
219222

220223
int lastVisible = visibleBounds[1][0];
221224
if (lastVisible == -1) lastVisible = visibleBounds[1][1];
@@ -314,15 +317,16 @@ private int[][] getMinMaxPoints(XYItem item, Rectangle dirtyArea,
314317

315318
dirtyArea.grow(lineWidth, lineWidth);
316319
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;
317323

318-
int firstFirst = visibleBounds[0][0];
319-
int firstIndex = firstFirst;
324+
int firstIndex = visibleBounds[0][0];
320325
if (firstIndex == -1) firstIndex = visibleBounds[0][1];
321-
if (firstIndex == -1) return null;
326+
if (firstIndex == -1) firstIndex = 0;
322327

323328
int valuesCount = item.getValuesCount();
324-
int lastFirst = visibleBounds[1][0];
325-
int lastIndex = lastFirst;
329+
int lastIndex = visibleBounds[1][0];
326330
if (lastIndex == -1) lastIndex = visibleBounds[1][1];
327331
if (lastIndex == -1) lastIndex = valuesCount - 1;
328332

0 commit comments

Comments
 (0)