1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-13 20:24:14 +02:00

Increase the offset so that Y-axis labels with decimals places fit (#969)

* Added multipler to increase the space reserved for the chart labels which fixes the cases when labels with decimals places do not fit

* Changed dirty fix to a less dirty fix

* Removed multiplier

* Removed x2 multiplier which was in the charting library code because it look like it reserves enough space without it
This commit is contained in:
undefiened
2023-07-22 14:27:34 +02:00
committed by GitHub
parent 5b18ba2bb7
commit b75d1133e6

View File

@@ -293,14 +293,19 @@ public class ChartMeasurementView extends LineChart {
offsetBottom += Math.max(70f, mOffsetsBuffer.bottom);
// offsets for y-labels
// add one symbol worth of offset to avoid cutting decimal places
float additionalWidth = (float) Utils.calcTextWidth(mAxisRendererLeft
.getPaintAxisLabels(), "1");
if (mAxisLeft.needsOffset()) {
offsetLeft += mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft
.getPaintAxisLabels());
.getPaintAxisLabels()) + additionalWidth;
}
if (mAxisRight.needsOffset()) {
offsetRight += mAxisRight.getRequiredWidthSpace(mAxisRendererRight
.getPaintAxisLabels());
.getPaintAxisLabels()) + additionalWidth;
}
if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {