XYSeriesgetRange이라는 메서드를 변경하여 알아 냈습니다.
public synchronized RangeHolderWithDiff getRange(double start, double stop,
boolean beforeAfterPoints) {
int diff = 0;
if (beforeAfterPoints) {
// we need to add one point before the start and one point after the end
// (if
// there are any)
// to ensure that line doesn't end before the end of the screen
// this would be simply: start = mXY.lowerKey(start) but NavigableMap is
// available since API 9
SortedMap<Double, Double> headMap = mXY.headMap(start);
if (!headMap.isEmpty()) {
start = headMap.lastKey();
diff = headMap.size();
System.out.println("DIFF IS " + diff);
}
// this would be simply: end = mXY.higherKey(end) but NavigableMap is
// available since API 9
// so we have to do this hack in order to support older versions
SortedMap<Double, Double> tailMap = mXY.tailMap(stop);
if (!tailMap.isEmpty()) {
Iterator<Double> tailIterator = tailMap.keySet().iterator();
Double next = tailIterator.next();
if (tailIterator.hasNext()) {
stop = tailIterator.next();
} else {
stop += next;
}
}
}
RangeHolderWithDiff mRangeHolderWithDiff = new RangeHolderWithDiff();
mRangeHolderWithDiff.indexDiff = diff;
mRangeHolderWithDiff.sortedMap = mXY.subMap(start, stop);
return mRangeHolderWithDiff;
}
은 diff 변수가 당신에게 여분의 X 값의 수를 제공, 난 touchAreas이 매개 변수를 추가하려합니다. 내가 할 수 있으면 나는 나의 대답을 편집 할 것이다. 행운을 빕니다.