Skip to content

Commit

Permalink
Fix ErrorDataSetRenderer for inverted x-Axis
Browse files Browse the repository at this point in the history
For inverted x-Axis, the Renderer first checked for the points to
render and then swapped them and tried to account for the fact that the
points might not be exactly on the axis bounds by adding a fixed extra
point to each side, which should have been two, because the code which
determines which points to include for normal axes also adds one in the
other direction.
This commit replaces this by the cleaner approach of obtaining xMax at
the left bound of an inverted axis and vice versa.
  • Loading branch information
wirew0rm authored and RalphSteinhagen committed Sep 30, 2020
1 parent 7586b19 commit e5f9425
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ public List<DataSet> render(final GraphicsContext gc, final Chart chart, final i
final Axis yAxis = yAxisTemp;
final long start = ProcessingProfiler.getTimeStamp();
final double xAxisWidth = xAxis.getWidth();
final double xMin = xAxis.getValueForDisplay(0);
final double xMax = xAxis.getValueForDisplay(xAxisWidth);
final boolean xAxisInverted = xAxis.isInvertedAxis();
final double xMin = xAxis.getValueForDisplay(xAxisInverted ? xAxisWidth : 0.0);
final double xMax = xAxis.getValueForDisplay(xAxisInverted ? 0.0 : xAxisWidth);

if (ProcessingProfiler.getDebugState()) {
ProcessingProfiler.getTimeDiff(start, "init");
Expand Down Expand Up @@ -201,11 +202,6 @@ public List<DataSet> render(final GraphicsContext gc, final Chart chart, final i
indexMin = 0;
indexMax = dataSet.getDataCount();
}
if (xAxis.isInvertedAxis()) {
final int temp = indexMin;
indexMin = indexMax - 1;
indexMax = temp + 1;
}

if (indexMax - indexMin <= 0) {
// zero length/range data set -> nothing to be drawn
Expand Down

0 comments on commit e5f9425

Please sign in to comment.