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

more work on axis tick calculators, making abstract

parent 992e71aa
No related branches found
No related tags found
No related merge requests found
Showing
with 211 additions and 245 deletions
......@@ -33,7 +33,7 @@ public class Axis implements ChartPart {
public enum AxisType {
Number, Date, Logarithmic;
Number, Date;
}
/** parent */
......
......@@ -23,8 +23,7 @@ import com.xeiam.xchart.Chart;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.AxisTickCalculator;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DateAxisTickCalculator;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DecimalAxisTickCalculator;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.LogarithmicAxisTickCalculator;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.NumberAxisTickCalculator;
/**
* An axis tick
......@@ -84,17 +83,19 @@ public class AxisTick implements ChartPart {
if (axis.getAxisType() == AxisType.Number) {
gridStep = new DecimalAxisTickCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChart().getStyleManager());
gridStep = new NumberAxisTickCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChart().getStyleManager());
} else if (axis.getAxisType() == AxisType.Date) {
gridStep = new DateAxisTickCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChart().getStyleManager());
} else if (axis.getAxisType() == AxisType.Logarithmic) {
gridStep = new LogarithmicAxisTickCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChart().getStyleManager());
}
// if (getChart().getStyleManager()) {
//
// gridStep = new LogarithmicAxisTickCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChart().getStyleManager());
// }
if (isVisible) {
axisTickLabels.paint(g);
......
......@@ -21,15 +21,103 @@
*/
package com.xeiam.xchart.internal.chartpart.axistickcalculator;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.AxisPair;
import com.xeiam.xchart.style.StyleManager;
/**
* @author timmolter
*/
public interface AxisTickCalculator {
public abstract class AxisTickCalculator {
/** the default tick mark step hint for x axis */
protected static final int DEFAULT_TICK_MARK_STEP_HINT_X = 74;
/** the default tick mark step hint for y axis */
protected static final int DEFAULT_TICK_MARK_STEP_HINT_Y = 44;
/** the List of tick label position in pixels */
protected List<Integer> tickLocations = new LinkedList<Integer>();;
/** the List of tick label values */
protected List<String> tickLabels = new LinkedList<String>();
protected final Direction axisDirection;
protected final int workingSpace;
protected final BigDecimal minValue;
protected final BigDecimal maxValue;
protected final StyleManager styleManager;
public AxisTickCalculator(Direction axisDirection, int workingSpace, BigDecimal minValue, BigDecimal maxValue, StyleManager styleManager) {
this.axisDirection = axisDirection;
this.workingSpace = workingSpace;
this.minValue = minValue;
this.maxValue = maxValue;
this.styleManager = styleManager;
calculate();
}
private void calculate() {
// a check if all axis data are the exact same values
if (minValue == maxValue) {
if (getAxisType() == AxisType.Number) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(maxValue));
} else if (getAxisType() == AxisType.Date) {
tickLabels.add(styleManager.getDateFormatter().formatDateValue(maxValue, maxValue, maxValue));
}
tickLocations.add((int) (workingSpace / 2.0));
return;
}
// tick space - a percentage of the working space available for ticks, i.e. 95%
int tickSpace = AxisPair.getTickSpace(workingSpace); // in plot space
// where the tick should begin in the working space in pixels
int margin = AxisPair.getTickStartOffset(workingSpace, tickSpace); // in plot space BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal gridStep = getGridStep(tickSpace);
BigDecimal firstPosition = getFirstPosition(minValue, gridStep);
// generate all tickLabels and tickLocations from the first to last position
for (BigDecimal tickPosition = firstPosition; tickPosition.compareTo(maxValue) <= 0; tickPosition = tickPosition.add(gridStep)) {
if (getAxisType() == AxisType.Number) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(tickPosition));
} else if (getAxisType() == AxisType.Date) {
tickLabels.add(styleManager.getDateFormatter().formatDateValue(tickPosition, minValue, maxValue));
}
// here we convert tickPosition finally to plot space, i.e. pixels
int tickLabelPosition = (int) (margin + ((tickPosition.subtract(minValue)).doubleValue() / (maxValue.subtract(minValue)).doubleValue() * tickSpace));
tickLocations.add(tickLabelPosition);
}
}
public List<Integer> getTickLocations() {
return tickLocations;
}
public List<String> getTickLabels() {
return tickLabels;
}
public abstract BigDecimal getGridStep(int tickSpace);
public List<Integer> getTickLocations();
public abstract BigDecimal getFirstPosition(BigDecimal minValue, BigDecimal gridStep);
public List<String> getTickLabels();
public abstract AxisType getAxisType();
}
......@@ -22,11 +22,9 @@
package com.xeiam.xchart.internal.chartpart.axistickcalculator;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.AxisPair;
import com.xeiam.xchart.style.StyleManager;
/**
......@@ -34,29 +32,7 @@ import com.xeiam.xchart.style.StyleManager;
*
* @author timmolter
*/
public class DateAxisTickCalculator implements AxisTickCalculator {
/** the default tick mark step hint for x axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_X = 74;
/** the default tick mark step hint for y axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_Y = 44;
/** the List of tick label position in pixels */
private List<Integer> tickLocations = new LinkedList<Integer>();;
/** the List of tick label values */
private List<String> tickLabels = new LinkedList<String>();
private final Direction axisDirection;
private final int workingSpace;
private final BigDecimal minValue;
private final BigDecimal maxValue;
private final StyleManager styleManager;
public class DateAxisTickCalculator extends AxisTickCalculator {
/**
* Constructor
......@@ -69,43 +45,8 @@ public class DateAxisTickCalculator implements AxisTickCalculator {
*/
public DateAxisTickCalculator(Direction axisDirection, int workingSpace, BigDecimal minValue, BigDecimal maxValue, StyleManager styleManager) {
this.axisDirection = axisDirection;
this.workingSpace = workingSpace;
this.minValue = minValue;
this.maxValue = maxValue;
this.styleManager = styleManager;
calculate();
}
private void calculate() {
// a check if all axis data are the exact same values
if (minValue == maxValue) {
tickLabels.add(styleManager.getDateFormatter().formatDateValue(maxValue, maxValue, maxValue));
tickLocations.add((int) (workingSpace / 2.0));
return;
}
// tick space - a percentage of the working space available for ticks, i.e. 95%
int tickSpace = AxisPair.getTickSpace(workingSpace); // in plot space
System.out.println("tickSpace= " + tickSpace);
// where the tick should begin in the working space in pixels
int margin = AxisPair.getTickStartOffset(workingSpace, tickSpace); // in plot space BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal gridStep = getGridStepForDecimal(tickSpace);
super(axisDirection, workingSpace, minValue, maxValue, styleManager);
BigDecimal firstPosition = getFirstPosition(minValue, gridStep);
// generate all tickLabels and tickLocations from the first to last position
for (BigDecimal tickPosition = firstPosition; tickPosition.compareTo(maxValue) <= 0; tickPosition = tickPosition.add(gridStep)) {
tickLabels.add(styleManager.getDateFormatter().formatDateValue(tickPosition, minValue, maxValue));
// here we convert tickPosition finally to plot space, i.e. pixels
int tickLabelPosition = (int) (margin + ((tickPosition.subtract(minValue)).doubleValue() / (maxValue.subtract(minValue)).doubleValue() * tickSpace));
tickLocations.add(tickLabelPosition);
}
}
/**
......@@ -114,7 +55,8 @@ public class DateAxisTickCalculator implements AxisTickCalculator {
* @param tickSpace in plot space
* @return
*/
private BigDecimal getGridStepForDecimal(int tickSpace) {
@Override
public BigDecimal getGridStep(int tickSpace) {
// the span of the data
double span = Math.abs(maxValue.subtract(minValue).doubleValue()); // in data space
......@@ -182,7 +124,8 @@ public class DateAxisTickCalculator implements AxisTickCalculator {
return value;
}
private BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
@Override
public BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
BigDecimal firstPosition;
if (min.remainder(gridStep).doubleValue() <= 0.0) {
......@@ -194,15 +137,9 @@ public class DateAxisTickCalculator implements AxisTickCalculator {
}
@Override
public List<Integer> getTickLocations() {
return tickLocations;
}
@Override
public List<String> getTickLabels() {
public AxisType getAxisType() {
return tickLabels;
return AxisType.Date;
}
}
......@@ -22,11 +22,9 @@
package com.xeiam.xchart.internal.chartpart.axistickcalculator;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.AxisPair;
import com.xeiam.xchart.style.StyleManager;
/**
......@@ -34,29 +32,7 @@ import com.xeiam.xchart.style.StyleManager;
*
* @author timmolter
*/
public class LogarithmicAxisTickCalculator implements AxisTickCalculator {
/** the default tick mark step hint for x axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_X = 74;
/** the default tick mark step hint for y axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_Y = 44;
/** the List of tick label position in pixels */
private List<Integer> tickLocations = new LinkedList<Integer>();;
/** the List of tick label values */
private List<String> tickLabels = new LinkedList<String>();
private final Direction axisDirection;
private final int workingSpace;
private final BigDecimal minValue;
private final BigDecimal maxValue;
private final StyleManager styleManager;
public class LogarithmicAxisTickCalculator extends AxisTickCalculator {
/**
* Constructor
......@@ -69,43 +45,7 @@ public class LogarithmicAxisTickCalculator implements AxisTickCalculator {
*/
public LogarithmicAxisTickCalculator(Direction axisDirection, int workingSpace, BigDecimal minValue, BigDecimal maxValue, StyleManager styleManager) {
this.axisDirection = axisDirection;
this.workingSpace = workingSpace;
this.minValue = minValue;
this.maxValue = maxValue;
this.styleManager = styleManager;
calculate();
}
private void calculate() {
// a check if all axis data are the exact same values
if (minValue == maxValue) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(maxValue));
tickLocations.add((int) (workingSpace / 2.0));
return;
}
// tick space - a percentage of the working space available for ticks, i.e. 95%
int tickSpace = AxisPair.getTickSpace(workingSpace); // in plot space
System.out.println("tickSpace= " + tickSpace);
// where the tick should begin in the working space in pixels
int margin = AxisPair.getTickStartOffset(workingSpace, tickSpace); // in plot space BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal firstPosition = getFirstPosition(minValue, gridStep);
// generate all tickLabels and tickLocations from the first to last position
for (BigDecimal tickPosition = firstPosition; tickPosition.compareTo(maxValue) <= 0; tickPosition = tickPosition.add(gridStep)) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(tickPosition));
// here we convert tickPosition finally to plot space, i.e. pixels
int tickLabelPosition = (int) (margin + ((tickPosition.subtract(minValue)).doubleValue() / (maxValue.subtract(minValue)).doubleValue() * tickSpace));
tickLocations.add(tickLabelPosition);
}
super(axisDirection, workingSpace, minValue, maxValue, styleManager);
}
/**
......@@ -114,7 +54,8 @@ public class LogarithmicAxisTickCalculator implements AxisTickCalculator {
* @param tickSpace in plot space
* @return
*/
private BigDecimal getGridStepForDecimal(int tickSpace) {
@Override
public BigDecimal getGridStep(int tickSpace) {
// the span of the data
double span = Math.abs(maxValue.subtract(minValue).doubleValue()); // in data space
......@@ -182,7 +123,8 @@ public class LogarithmicAxisTickCalculator implements AxisTickCalculator {
return value;
}
private BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
@Override
public BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
BigDecimal firstPosition;
if (min.remainder(gridStep).doubleValue() <= 0.0) {
......@@ -194,15 +136,8 @@ public class LogarithmicAxisTickCalculator implements AxisTickCalculator {
}
@Override
public List<Integer> getTickLocations() {
public AxisType getAxisType() {
return tickLocations;
return AxisType.Number;
}
@Override
public List<String> getTickLabels() {
return tickLabels;
}
}
......@@ -22,11 +22,9 @@
package com.xeiam.xchart.internal.chartpart.axistickcalculator;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.AxisPair;
import com.xeiam.xchart.style.StyleManager;
/**
......@@ -34,29 +32,7 @@ import com.xeiam.xchart.style.StyleManager;
*
* @author timmolter
*/
public class DecimalAxisTickCalculator implements AxisTickCalculator {
/** the default tick mark step hint for x axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_X = 74;
/** the default tick mark step hint for y axis */
private static final int DEFAULT_TICK_MARK_STEP_HINT_Y = 44;
/** the List of tick label position in pixels */
private List<Integer> tickLocations = new LinkedList<Integer>();;
/** the List of tick label values */
private List<String> tickLabels = new LinkedList<String>();
private final Direction axisDirection;
private final int workingSpace;
private final BigDecimal minValue;
private final BigDecimal maxValue;
private final StyleManager styleManager;
public class NumberAxisTickCalculator extends AxisTickCalculator {
/**
* Constructor
......@@ -67,45 +43,9 @@ public class DecimalAxisTickCalculator implements AxisTickCalculator {
* @param maxValue
* @param styleManager
*/
public DecimalAxisTickCalculator(Direction axisDirection, int workingSpace, BigDecimal minValue, BigDecimal maxValue, StyleManager styleManager) {
public NumberAxisTickCalculator(Direction axisDirection, int workingSpace, BigDecimal minValue, BigDecimal maxValue, StyleManager styleManager) {
this.axisDirection = axisDirection;
this.workingSpace = workingSpace;
this.minValue = minValue;
this.maxValue = maxValue;
this.styleManager = styleManager;
calculate();
}
private void calculate() {
// a check if all axis data are the exact same values
if (minValue == maxValue) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(maxValue));
tickLocations.add((int) (workingSpace / 2.0));
return;
}
// tick space - a percentage of the working space available for ticks, i.e. 95%
int tickSpace = AxisPair.getTickSpace(workingSpace); // in plot space
System.out.println("tickSpace= " + tickSpace);
// where the tick should begin in the working space in pixels
int margin = AxisPair.getTickStartOffset(workingSpace, tickSpace); // in plot space BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal gridStep = getGridStepForDecimal(tickSpace);
BigDecimal firstPosition = getFirstPosition(minValue, gridStep);
// generate all tickLabels and tickLocations from the first to last position
for (BigDecimal tickPosition = firstPosition; tickPosition.compareTo(maxValue) <= 0; tickPosition = tickPosition.add(gridStep)) {
tickLabels.add(styleManager.getDecimalFormatter().formatNumber(tickPosition));
// here we convert tickPosition finally to plot space, i.e. pixels
int tickLabelPosition = (int) (margin + ((tickPosition.subtract(minValue)).doubleValue() / (maxValue.subtract(minValue)).doubleValue() * tickSpace));
tickLocations.add(tickLabelPosition);
}
super(axisDirection, workingSpace, minValue, maxValue, styleManager);
}
/**
......@@ -114,7 +54,8 @@ public class DecimalAxisTickCalculator implements AxisTickCalculator {
* @param tickSpace in plot space
* @return
*/
private BigDecimal getGridStepForDecimal(int tickSpace) {
@Override
public BigDecimal getGridStep(int tickSpace) {
// the span of the data
double span = Math.abs(maxValue.subtract(minValue).doubleValue()); // in data space
......@@ -182,7 +123,8 @@ public class DecimalAxisTickCalculator implements AxisTickCalculator {
return value;
}
private BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
@Override
public BigDecimal getFirstPosition(final BigDecimal min, BigDecimal gridStep) {
BigDecimal firstPosition;
if (min.remainder(gridStep).doubleValue() <= 0.0) {
......@@ -194,15 +136,9 @@ public class DecimalAxisTickCalculator implements AxisTickCalculator {
}
@Override
public List<Integer> getTickLocations() {
return tickLocations;
}
@Override
public List<String> getTickLabels() {
public AxisType getAxisType() {
return tickLabels;
return AxisType.Number;
}
}
......@@ -29,7 +29,7 @@ import java.util.Locale;
/**
* @author timmolter
*/
public class DecimalFormatter {
public class NumberFormatter {
private String normalDecimalPattern;
private String scientificDecimalPattern;
......@@ -39,7 +39,7 @@ public class DecimalFormatter {
/**
* Constructor
*/
public DecimalFormatter() {
public NumberFormatter() {
normalDecimalPattern = "#.####";
scientificDecimalPattern = "0.##E0";
......
......@@ -26,7 +26,7 @@ import java.awt.Font;
import java.awt.Stroke;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DateFormatter;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DecimalFormatter;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.NumberFormatter;
import com.xeiam.xchart.style.theme.Theme;
import com.xeiam.xchart.style.theme.XChartTheme;
......@@ -98,7 +98,7 @@ public class StyleManager {
// Formatting ////////////////////////////////
private DecimalFormatter decimalFormatter;
private NumberFormatter decimalFormatter;
private DateFormatter dateFormatter;
/**
......@@ -160,7 +160,7 @@ public class StyleManager {
errorBarsColor = theme.getErrorBarsColor();
// Formatting ////////////////////////////////
decimalFormatter = new DecimalFormatter();
decimalFormatter = new NumberFormatter();
dateFormatter = new DateFormatter();
}
......@@ -755,7 +755,7 @@ public class StyleManager {
// Formatting ////////////////////////////////
public DecimalFormatter getDecimalFormatter() {
public NumberFormatter getDecimalFormatter() {
return decimalFormatter;
}
......
......@@ -21,22 +21,34 @@
*/
package com.xeiam.xchart.unit;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DateAxisTickCalculator;
import com.xeiam.xchart.style.StyleManager;
/**
* @author timmolter
*/
public class DecimalGridStepTest {
public class DateAxisTickCalculatorTest {
@Test
public void testDateOneMinuteTimespan() {
// DecimalGridStep decimalGridStep = new DecimalGridStep();
// BigDecimal gridStep = decimalGridStep.getGridStepForDecimal(Direction.X, 30, 600);
// System.out.println("gridStep= " + gridStep);
// BigDecimal first = decimalGridStep.getFirstPosition(new BigDecimal(-15), gridStep);
// System.out.println("first= " + first);
DateAxisTickCalculator decimalAxisTickCalculator = new DateAxisTickCalculator(Direction.X, 600, new BigDecimal(1361110661000L), new BigDecimal(1361110721000L), new StyleManager());
}
List<String> tickLabels = decimalAxisTickCalculator.getTickLabels();
System.out.println(Arrays.toString(tickLabels.toArray()));
// assertThat(tickLabels.size(), equalTo(7));
// assertThat(tickLabels.get(0), equalTo("-15"));
// List<Integer> tickLocations = decimalAxisTickCalculator.getTickLocations();
// System.out.println(Arrays.toString(tickLocations.toArray()));
// assertThat(tickLocations.size(), equalTo(7));
// assertThat(tickLocations.get(0), equalTo(15));
}
}
/**
* Copyright (C) 2013 Xeiam LLC http://xeiam.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.unit;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import com.xeiam.xchart.internal.chartpart.Axis.Direction;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.NumberAxisTickCalculator;
import com.xeiam.xchart.style.StyleManager;
/**
* @author timmolter
*/
public class DecimalAxisTickCalculatorTest {
@Test
public void testDateOneMinuteTimespan() {
NumberAxisTickCalculator decimalAxisTickCalculator = new NumberAxisTickCalculator(Direction.X, 600, new BigDecimal(-15), new BigDecimal(15), new StyleManager());
List<String> tickLabels = decimalAxisTickCalculator.getTickLabels();
System.out.println(Arrays.toString(tickLabels.toArray()));
assertThat(tickLabels.size(), equalTo(7));
assertThat(tickLabels.get(0), equalTo("-15"));
List<Integer> tickLocations = decimalAxisTickCalculator.getTickLocations();
System.out.println(Arrays.toString(tickLocations.toArray()));
assertThat(tickLocations.size(), equalTo(7));
assertThat(tickLocations.get(0), equalTo(15));
}
}
......@@ -31,7 +31,7 @@ import java.util.TimeZone;
import org.junit.Test;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DateFormatter;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.DecimalFormatter;
import com.xeiam.xchart.internal.chartpart.axistickcalculator.NumberFormatter;
/**
* @author timmolter
......@@ -43,7 +43,7 @@ public class ValueFormatterTest {
@Test
public void testNumberFormatting() {
DecimalFormatter axisTickLabelFormatter = new DecimalFormatter();
NumberFormatter axisTickLabelFormatter = new NumberFormatter();
// big
axisTickLabelFormatter.setLocale(locale);
......
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