Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #94 from ShivamSoni24/40229448
Browse files Browse the repository at this point in the history
Updated Chart Fragment.java
  • Loading branch information
SecretAgentShh authored Oct 12, 2023
2 parents 0af7204 + b82dca2 commit 9c52c91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void clearTrackPoints() {
});
}
}

@Override
public void onSampledInTrackPoint(@NonNull TrackPoint trackPoint, @NonNull TrackStatistics trackStatistics) {
if (isResumed()) {
ChartPoint point = new ChartPoint(trackStatistics, trackPoint, trackPoint.getSpeed(), chartByDistance, viewBinding.chartView.getUnitSystem());
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/de/dennisguse/opentracks/chart/ChartView.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,16 +772,16 @@ private double getXAxisInterval() {
}

private List<Double> getXAxisMarkerPositions(double interval) {
List<Double> markers = new ArrayList<>();
markers.add(0d);
List<Double> xAxisMarkers = new ArrayList<>();
xAxisMarkers.add(0d);
for (int i = 1; i * interval < maxX; i++) {
markers.add(i * interval);
xAxisMarkers.add(i * interval);
}

if (markers.size() < 2) {
markers.add(maxX);
if (xAxisMarkers.size() < 2) {
xAxisMarkers.add(maxX);
}
return markers;
return xAxisMarkers;
}

/**
Expand Down Expand Up @@ -854,7 +854,7 @@ private void drawPointer(Canvas canvas) {
break;
}
}
if (firstChartValueSeries != null && chartPoints.size() > 0) {
if (firstChartValueSeries != null && !chartPoints.isEmpty()) {
int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2;
double value = firstChartValueSeries.extractDataFromChartPoint(last);
int dy = getY(firstChartValueSeries, value) - pointer.getIntrinsicHeight();
Expand Down

0 comments on commit 9c52c91

Please sign in to comment.