Skip to content
Snippets Groups Projects
Commit fbee064d authored by Tim Molter's avatar Tim Molter
Browse files

fixed rendering flaw with out of bounds min and max axes values

parent 0ecd472d
No related branches found
No related tags found
No related merge requests found
......@@ -102,10 +102,18 @@ public class PlotContentBarChart extends PlotContent {
if (xData.contains(categoryItr.next())) {
BigDecimal y = new BigDecimal(yItr.next().doubleValue());
int yTransform = (int) (bounds.getHeight() - (yTopMargin + y.subtract(yMin).doubleValue() / yMax.subtract(yMin).doubleValue() * yTickSpace));
BigDecimal yTop = new BigDecimal(y.doubleValue());
if (yTop.compareTo(yMax) > 0) {
yTop = yMax;
}
int yTransform = (int) (bounds.getHeight() - (yTopMargin + yTop.subtract(yMin).doubleValue() / yMax.subtract(yMin).doubleValue() * yTickSpace));
int yOffset = (int) (bounds.getY() + yTransform);
int zeroTransform = (int) (bounds.getHeight() - (yTopMargin + (yMin.subtract(yMin).doubleValue()) / (yMax.subtract(yMin).doubleValue()) * yTickSpace));
BigDecimal yBottom = new BigDecimal(y.doubleValue());
if (yBottom.compareTo(yMin) > 0) {
yBottom = yMin;
}
int zeroTransform = (int) (bounds.getHeight() - (yTopMargin + (yBottom.subtract(yMin).doubleValue()) / (yMax.subtract(yMin).doubleValue()) * yTickSpace));
int zeroOffset = (int) (bounds.getY() + zeroTransform);
// paint bar
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment