@Test public void findBorders_MaxMinEqual_MaxPlusStep() { BarSet set = new BarSet(); for (int i = 0; i < 2; i++) set.addBar(new Bar(Integer.toString(i), (float) 0)); mData = new ArrayList<>(); mData.add(set); assertArrayEquals(new int[] {0, 9}, mXRndr.findBorders(mData, 9)); }
int[] findBorders(ArrayList<ChartSet> sets) { float max = Integer.MIN_VALUE; float min = Integer.MAX_VALUE; for (ChartSet set : sets) { for (ChartEntry e : set.getEntries()) { if (e.getValue() >= max) max = e.getValue(); if (e.getValue() <= min) min = e.getValue(); } } max = (max < 0) ? 0 : (int) Math.ceil(max); min = (min > 0) ? 0 : (int) Math.floor(min); if (min == max) max += 1; return new int[] {(int) min, (int) max}; }
AxisRenderer { int[] findBorders(ArrayList<ChartSet> sets) { float max = Integer.MIN_VALUE; float min = Integer.MAX_VALUE; for (ChartSet set : sets) { for (ChartEntry e : set.getEntries()) { if (e.getValue() >= max) max = e.getValue(); if (e.getValue() <= min) min = e.getValue(); } } max = (max < 0) ? 0 : (int) Math.ceil(max); min = (min > 0) ? 0 : (int) Math.floor(min); if (min == max) max += 1; return new int[] {(int) min, (int) max}; } }
AxisRenderer { int[] findBorders(ArrayList<ChartSet> sets) { float max = Integer.MIN_VALUE; float min = Integer.MAX_VALUE; for (ChartSet set : sets) { for (ChartEntry e : set.getEntries()) { if (e.getValue() >= max) max = e.getValue(); if (e.getValue() <= min) min = e.getValue(); } } max = (max < 0) ? 0 : (int) Math.ceil(max); min = (min > 0) ? 0 : (int) Math.floor(min); if (min == max) max += 1; return new int[] {(int) min, (int) max}; } AxisRenderer(); }
AxisRenderer { int[] findBorders(ArrayList<ChartSet> sets) { float max = Integer.MIN_VALUE; float min = Integer.MAX_VALUE; for (ChartSet set : sets) { for (ChartEntry e : set.getEntries()) { if (e.getValue() >= max) max = e.getValue(); if (e.getValue() <= min) min = e.getValue(); } } max = (max < 0) ? 0 : (int) Math.ceil(max); min = (min > 0) ? 0 : (int) Math.floor(min); if (min == max) max += 1; return new int[] {(int) min, (int) max}; } AxisRenderer(); void init(ArrayList<ChartSet> data, Style style); abstract float parsePos(int index, double value); void reset(); float getInnerChartLeft(); float getInnerChartTop(); float getInnerChartRight(); float getInnerChartBottom(); float[] getInnerChartBounds(); int getStep(); float getBorderSpacing(); int getBorderMaximumValue(); int getBorderMinimumValue(); boolean hasMandatoryBorderSpacing(); boolean hasStep(); void setHandleValues(boolean bool); void setLabelsFormat(DecimalFormat format); void setStep(int step); void setBorderSpacing(float spacing); void setTopSpacing(float spacing); void setMandatoryBorderSpacing(boolean bool); void setInnerChartBounds(float left, float top, float right, float bottom); void setBorderValues(int min, int max, int step); void setBorderValues(int min, int max); }
AxisRenderer { int[] findBorders(ArrayList<ChartSet> sets) { float max = Integer.MIN_VALUE; float min = Integer.MAX_VALUE; for (ChartSet set : sets) { for (ChartEntry e : set.getEntries()) { if (e.getValue() >= max) max = e.getValue(); if (e.getValue() <= min) min = e.getValue(); } } max = (max < 0) ? 0 : (int) Math.ceil(max); min = (min > 0) ? 0 : (int) Math.floor(min); if (min == max) max += 1; return new int[] {(int) min, (int) max}; } AxisRenderer(); void init(ArrayList<ChartSet> data, Style style); abstract float parsePos(int index, double value); void reset(); float getInnerChartLeft(); float getInnerChartTop(); float getInnerChartRight(); float getInnerChartBottom(); float[] getInnerChartBounds(); int getStep(); float getBorderSpacing(); int getBorderMaximumValue(); int getBorderMinimumValue(); boolean hasMandatoryBorderSpacing(); boolean hasStep(); void setHandleValues(boolean bool); void setLabelsFormat(DecimalFormat format); void setStep(int step); void setBorderSpacing(float spacing); void setTopSpacing(float spacing); void setMandatoryBorderSpacing(boolean bool); void setInnerChartBounds(float left, float top, float right, float bottom); void setBorderValues(int min, int max, int step); void setBorderValues(int min, int max);  }