mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-17 14:10:54 +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:
@@ -293,14 +293,19 @@ public class ChartMeasurementView extends LineChart {
|
|||||||
offsetBottom += Math.max(70f, mOffsetsBuffer.bottom);
|
offsetBottom += Math.max(70f, mOffsetsBuffer.bottom);
|
||||||
|
|
||||||
// offsets for y-labels
|
// 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()) {
|
if (mAxisLeft.needsOffset()) {
|
||||||
offsetLeft += mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft
|
offsetLeft += mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft
|
||||||
.getPaintAxisLabels());
|
.getPaintAxisLabels()) + additionalWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAxisRight.needsOffset()) {
|
if (mAxisRight.needsOffset()) {
|
||||||
offsetRight += mAxisRight.getRequiredWidthSpace(mAxisRendererRight
|
offsetRight += mAxisRight.getRequiredWidthSpace(mAxisRendererRight
|
||||||
.getPaintAxisLabels());
|
.getPaintAxisLabels()) + additionalWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {
|
if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {
|
||||||
|
Reference in New Issue
Block a user