On matrix plots the coordinates must be rounded from calculated values, and not casted

This commit is contained in:
2014-09-10 08:51:19 +02:00
parent 4c86952b79
commit 4a5df6042e

View File

@@ -52,8 +52,9 @@ abstract public class MatrixPlotBase extends PlotBase<MatrixPlotSeries> implemen
if ((series == null) || (getNumberOfSeries() == 0)) {
return;
}
final int indexX = ((int) ((x - series.getMinX()) / series.getBinWidthX()));
final int indexY = ((int) ((y - series.getMinY()) / series.getBinWidthY()));
final int indexX = (int)Math.round((x - series.getMinX()) / series.getBinWidthX());
final int indexY = (int)Math.round((y - series.getMinY()) / series.getBinWidthY());
if (!series.contains(indexX, indexY)) {
return;
}