@Test public void measureInnerChartRight_NoData_Result() { when(mStyleMock.getLabelsPaint()).thenReturn(mMockPaint); when(mMockPaint.measureText("1")).thenReturn(6.f); ArrayList data = new ArrayList<BarSet>(); data.add(new BarSet()); mXRndr.init(data, mStyleMock); assertEquals(5.f, mXRndr.measureInnerChartRight(5), RESULT_THRESHOLD); }
protected float measureInnerChartRight(int right) { float lastLabelWidth = 0; if (nLabels > 0) lastLabelWidth = style.getLabelsPaint().measureText(labels.get(nLabels - 1)); float rightBorder = 0; if (style.getXLabelsPositioning() != LabelPosition.NONE && borderSpacing + mandatoryBorderSpacing < lastLabelWidth / 2) rightBorder = lastLabelWidth / 2 - (borderSpacing + mandatoryBorderSpacing); return right - rightBorder; }
XRenderer extends AxisRenderer { protected float measureInnerChartRight(int right) { float lastLabelWidth = 0; if (nLabels > 0) lastLabelWidth = style.getLabelsPaint().measureText(labels.get(nLabels - 1)); float rightBorder = 0; if (style.getXLabelsPositioning() != LabelPosition.NONE && borderSpacing + mandatoryBorderSpacing < lastLabelWidth / 2) rightBorder = lastLabelWidth / 2 - (borderSpacing + mandatoryBorderSpacing); return right - rightBorder; } }
XRenderer extends AxisRenderer { protected float measureInnerChartRight(int right) { float lastLabelWidth = 0; if (nLabels > 0) lastLabelWidth = style.getLabelsPaint().measureText(labels.get(nLabels - 1)); float rightBorder = 0; if (style.getXLabelsPositioning() != LabelPosition.NONE && borderSpacing + mandatoryBorderSpacing < lastLabelWidth / 2) rightBorder = lastLabelWidth / 2 - (borderSpacing + mandatoryBorderSpacing); return right - rightBorder; } XRenderer(); }
XRenderer extends AxisRenderer { protected float measureInnerChartRight(int right) { float lastLabelWidth = 0; if (nLabels > 0) lastLabelWidth = style.getLabelsPaint().measureText(labels.get(nLabels - 1)); float rightBorder = 0; if (style.getXLabelsPositioning() != LabelPosition.NONE && borderSpacing + mandatoryBorderSpacing < lastLabelWidth / 2) rightBorder = lastLabelWidth / 2 - (borderSpacing + mandatoryBorderSpacing); return right - rightBorder; } XRenderer(); @Override void dispose(); @Override void measure(int left, int top, int right, int bottom); @Override void draw(Canvas canvas); @Override float parsePos(int index, double value); }
XRenderer extends AxisRenderer { protected float measureInnerChartRight(int right) { float lastLabelWidth = 0; if (nLabels > 0) lastLabelWidth = style.getLabelsPaint().measureText(labels.get(nLabels - 1)); float rightBorder = 0; if (style.getXLabelsPositioning() != LabelPosition.NONE && borderSpacing + mandatoryBorderSpacing < lastLabelWidth / 2) rightBorder = lastLabelWidth / 2 - (borderSpacing + mandatoryBorderSpacing); return right - rightBorder; } XRenderer(); @Override void dispose(); @Override void measure(int left, int top, int right, int bottom); @Override void draw(Canvas canvas); @Override float parsePos(int index, double value);  }