From cbfb39e48d6dc9efea1cfba0bdd8b32ec05db72c Mon Sep 17 00:00:00 2001
From: Tim Molter <tim.molter@gmail.com>
Date: Sun, 10 Feb 2013 09:38:22 +0100
Subject: [PATCH] moved all formatting code to a ValueFormatter class.

---
 .../xeiam/xchart/demo/charts/Example1.java    |   2 +-
 .../xeiam/xchart/demo/charts/Example10.java   |   2 +-
 .../xeiam/xchart/demo/charts/Example2.java    |   6 +-
 .../xeiam/xchart/demo/charts/Example3.java    |   2 +-
 .../xeiam/xchart/demo/charts/Example4.java    |   4 +-
 .../xeiam/xchart/demo/charts/Example5.java    |   2 +-
 .../xeiam/xchart/demo/charts/Example6.java    |   2 +-
 .../xeiam/xchart/demo/charts/Example7.java    |   2 +-
 .../xeiam/xchart/demo/charts/Example9.java    |  12 +-
 .../com/xeiam/xchart/example/Example1.java    |   2 +-
 .../src/main/java/com/xeiam/xchart/Chart.java |  97 ++----------
 .../java/com/xeiam/xchart/QuickChart.java     |   4 +-
 .../xeiam/xchart/internal/chartpart/Axis.java |   2 +-
 .../xchart/internal/chartpart/AxisTick.java   |   9 +-
 .../internal/chartpart/AxisTickMarks.java     |   2 +
 .../xchart/internal/chartpart/AxisTitle.java  |  12 +-
 .../xchart/internal/chartpart/ChartTitle.java |   5 +
 .../internal/chartpart/PlotContent.java       |   7 +-
 .../internal/chartpart/PlotSurface.java       |  38 +----
 .../com/xeiam/xchart/style/StyleManager.java  |  57 +++++++
 .../ValueFormatter.java}                      | 140 ++++++++++++------
 .../com/xeiam/xchart/style/theme/Theme.java   |   8 +
 .../xeiam/xchart/style/theme/XChartTheme.java |  21 +++
 ...ormatTest.java => ValueFormatterTest.java} |  63 ++++----
 24 files changed, 276 insertions(+), 225 deletions(-)
 rename xchart/src/main/java/com/xeiam/xchart/{internal/misc/AxisValueFormatterUtil.java => style/ValueFormatter.java} (52%)
 rename xchart/src/test/java/com/xeiam/xchart/{ValueFormatTest.java => ValueFormatterTest.java} (68%)

diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example1.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example1.java
index ea3bf42f..19e3cea8 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example1.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example1.java
@@ -74,7 +74,7 @@ public class Example1 implements ExampleChart {
     Chart chart = new Chart(800, 600);
 
     // Customize Chart
-    chart.setTitle("Example1");
+    chart.setChartTitle("Example1");
     chart.getStyleManager().setChartTitleVisible(false);
     chart.getStyleManager().setLegendVisible(false);
 
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example10.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example10.java
index a12b450b..422ca389 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example10.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example10.java
@@ -43,7 +43,7 @@ public class Example10 implements ExampleChart {
     Chart chart = new Chart(800, 600);
 
     // Customize Chart
-    chart.setTitle("Example10");
+    chart.setChartTitle("Example10");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
     chart.getStyleManager().setLegendVisible(false);
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example2.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example2.java
index 01474ec6..7eae57a5 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example2.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example2.java
@@ -16,7 +16,7 @@
 package com.xeiam.xchart.demo.charts;
 
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.List;
 
 import com.xeiam.xchart.Chart;
 import com.xeiam.xchart.SwingWrapper;
@@ -44,8 +44,8 @@ public class Example2 implements ExampleChart {
 
     // generates sine data
     int size = 30;
-    Collection<Number> xData1 = new ArrayList<Number>();
-    Collection<Number> yData1 = new ArrayList<Number>();
+    List<Number> xData1 = new ArrayList<Number>();
+    List<Number> yData1 = new ArrayList<Number>();
     for (int i = 0; i <= size; i++) {
       double radians = (Math.PI / (size / 2) * i);
       xData1.add(i - size / 2);
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example3.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example3.java
index fb0740aa..9b4659d3 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example3.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example3.java
@@ -53,7 +53,7 @@ public class Example3 implements ExampleChart {
       }
 
       // Customize Chart
-      chart.setTitle("Example3");
+      chart.setChartTitle("Example3");
       chart.setXAxisTitle("X");
       chart.setYAxisTitle("Y");
 
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example4.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example4.java
index 5884ae34..b73bb55a 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example4.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example4.java
@@ -65,10 +65,10 @@ public class Example4 implements ExampleChart {
     }
 
     // Customize Chart
-    chart.setTitle("Example4");
+    chart.setChartTitle("Example4");
     chart.setXAxisTitle("time of day");
     chart.setYAxisTitle("gigawatts");
-    chart.setTimezone(TimeZone.getTimeZone("UTC"));
+    chart.getValueFormatter().setTimezone(TimeZone.getTimeZone("UTC"));
 
     Series series = chart.addDateSeries("value", xData, yData);
 
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example5.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example5.java
index 5f90fba1..7f8e9584 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example5.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example5.java
@@ -39,7 +39,7 @@ public class Example5 implements ExampleChart {
     Chart chart = new Chart(800, 600);
 
     // Customize Chart
-    chart.setTitle("Example5");
+    chart.setChartTitle("Example5");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
 
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example6.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example6.java
index 0571a58c..ef8b9e73 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example6.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example6.java
@@ -39,7 +39,7 @@ public class Example6 implements ExampleChart {
     Chart chart = new Chart(800, 600);
 
     // Customize Chart
-    chart.setTitle("Example6");
+    chart.setChartTitle("Example6");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
 
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example7.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example7.java
index f995d366..0b006b1d 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example7.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example7.java
@@ -43,7 +43,7 @@ public class Example7 implements ExampleChart {
 
     // Create Chart
     Chart chart = new Chart(800, 600);
-    chart.setTitle("Example7");
+    chart.setChartTitle("Example7");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
     chart.addSeries("y(x)", xData, yData);
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example9.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example9.java
index be243f17..9d669ed8 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example9.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example9.java
@@ -71,11 +71,11 @@ public class Example9 implements ExampleChart {
     }
 
     // Customize Chart
-    chart.setTitle("Sample Chart Extensive Cusomization");
+    chart.setChartTitle("Sample Chart Extensive Cusomization");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
-    chart.setForegroundColor(ChartColor.getAWTColor(ChartColor.GREY));
-    chart.setGridLinesColor(new Color(255, 255, 255));
+    chart.getStyleManager().setPlotBackgroundColor(ChartColor.getAWTColor(ChartColor.GREY));
+    chart.getStyleManager().setPlotGridLinesColor(new Color(255, 255, 255));
     chart.getStyleManager().setChartBackgroundColor(Color.WHITE);
     chart.getStyleManager().setLegendBackgroundColor(Color.PINK);
     chart.getStyleManager().setChartBordersColor(Color.GREEN);
@@ -84,9 +84,9 @@ public class Example9 implements ExampleChart {
     chart.getStyleManager().setLegendFont(new Font(Font.SERIF, Font.PLAIN, 18));
     chart.getStyleManager().setAxisTitleFont(new Font(Font.SANS_SERIF, Font.ITALIC, 18));
     chart.getStyleManager().setAxisTicksFont(new Font(Font.SERIF, Font.PLAIN, 11));
-    chart.setDateFormatter("dd-MMM");
-    chart.setDecmialFormatter("#.000");
-    chart.setLocale(Locale.GERMAN);
+    chart.getValueFormatter().setDatePattern("dd-MMM");
+    chart.getValueFormatter().setNormalDecimalPattern("#.000");
+    chart.getValueFormatter().setLocale(Locale.GERMAN);
 
     Series series = chart.addDateSeries("Fake Data", xData, yData);
     series.setLineColor(SeriesColor.BLUE);
diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/example/Example1.java b/xchart-demo/src/main/java/com/xeiam/xchart/example/Example1.java
index 8ee1128d..86154f30 100644
--- a/xchart-demo/src/main/java/com/xeiam/xchart/example/Example1.java
+++ b/xchart-demo/src/main/java/com/xeiam/xchart/example/Example1.java
@@ -31,7 +31,7 @@ public class Example1 {
 
     // Create Chart
     Chart chart = new Chart(500, 400);
-    chart.setTitle("Sample Chart");
+    chart.setChartTitle("Sample Chart");
     chart.setXAxisTitle("X");
     chart.setYAxisTitle("Y");
     chart.addSeries("y(x)", null, yData);
diff --git a/xchart/src/main/java/com/xeiam/xchart/Chart.java b/xchart/src/main/java/com/xeiam/xchart/Chart.java
index 20fd1971..eea03564 100644
--- a/xchart/src/main/java/com/xeiam/xchart/Chart.java
+++ b/xchart/src/main/java/com/xeiam/xchart/Chart.java
@@ -15,14 +15,11 @@
  */
 package com.xeiam.xchart;
 
-import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
 
 import com.xeiam.xchart.internal.chartpart.AxisPair;
 import com.xeiam.xchart.internal.chartpart.ChartTitle;
@@ -30,6 +27,7 @@ import com.xeiam.xchart.internal.chartpart.Legend;
 import com.xeiam.xchart.internal.chartpart.Plot;
 import com.xeiam.xchart.style.Series;
 import com.xeiam.xchart.style.StyleManager;
+import com.xeiam.xchart.style.ValueFormatter;
 import com.xeiam.xchart.style.theme.Theme;
 
 /**
@@ -43,6 +41,7 @@ public class Chart {
   public int height;
 
   private StyleManager styleManager = new StyleManager();
+  private ValueFormatter valueFormatter = new ValueFormatter();
 
   // Chart Parts
   public ChartTitle chartTitle = new ChartTitle(this);
@@ -71,7 +70,7 @@ public class Chart {
   public Chart(ChartBuilder chartBuilder) {
 
     this(chartBuilder.width, chartBuilder.height);
-    setTitle(chartBuilder.title);
+    setChartTitle(chartBuilder.title);
     setXAxisTitle(chartBuilder.xAxisTitle);
     setYAxisTitle(chartBuilder.yAxisTitle);
     styleManager.setLegendVisible(chartBuilder.isLegendVisible);
@@ -219,7 +218,7 @@ public class Chart {
    * 
    * @param title
    */
-  public void setTitle(String title) {
+  public void setChartTitle(String title) {
 
     this.chartTitle.setText(title);
   }
@@ -236,7 +235,7 @@ public class Chart {
     } else {
       styleManager.setxAxisTitleVisible(true);
     }
-    this.axisPair.xAxis.axisTitle.setText(title);
+    this.axisPair.xAxis.axisTitle.text = title;
   }
 
   /**
@@ -251,81 +250,7 @@ public class Chart {
     } else {
       styleManager.setyAxisTitleVisible(true);
     }
-    this.axisPair.yAxis.axisTitle.setText(title);
-  }
-
-  /**
-   * Set the chart foreground color - the part the series are drawn on
-   * 
-   * @param color
-   */
-  public void setForegroundColor(Color color) {
-
-    this.plot.plotSurface.setForegroundColor(color);
-  }
-
-  /**
-   * Set the chart grid lines color
-   * 
-   * @param color
-   */
-  public void setGridLinesColor(Color color) {
-
-    this.plot.plotSurface.setGridLinesColor(color);
-  }
-
-  /**
-   * Set the String formatter for Data x-axis
-   * 
-   * @param pattern - the pattern describing the date and time format
-   */
-  public void setDateFormatter(String pattern) {
-
-    this.axisPair.xAxis.axisTick.datePattern = pattern;
-  }
-
-  /**
-   * Set the decimal formatter for all tick labels
-   * 
-   * @param pattern - the pattern describing the decimal format
-   */
-  public void setDecmialFormatter(String pattern) {
-
-    this.axisPair.xAxis.axisTick.normalDecimalPattern = pattern;
-    this.axisPair.yAxis.axisTick.normalDecimalPattern = pattern;
-  }
-
-  /**
-   * Set the scientific notation formatter for all tick labels
-   * 
-   * @param pattern - the pattern describing the scientific notation format
-   */
-  public void setDecmialScientificFormatter(String pattern) {
-
-    this.axisPair.xAxis.axisTick.scientificDecimalPattern = pattern;
-    this.axisPair.yAxis.axisTick.scientificDecimalPattern = pattern;
-  }
-
-  /**
-   * Set the locale to use for rendering the chart
-   * 
-   * @param locale - the locale to use when formatting Strings and dates for the axis tick labels
-   */
-  public void setLocale(Locale locale) {
-
-    this.axisPair.xAxis.axisTick.locale = locale;
-    this.axisPair.yAxis.axisTick.locale = locale;
-  }
-
-  /**
-   * Set the timezone to use for formatting Date axis tick labels
-   * 
-   * @param timezone the timezone to use when formatting date data
-   */
-  public void setTimezone(TimeZone timezone) {
-
-    this.axisPair.xAxis.axisTick.timezone = timezone;
-    this.axisPair.yAxis.axisTick.timezone = timezone;
+    this.axisPair.yAxis.axisTitle.text = title;
   }
 
   /**
@@ -349,4 +274,14 @@ public class Chart {
 
   }
 
+  /**
+   * Gets the Chart's value formatter, which can be used to customize the formatting of numbers and dates
+   * 
+   * @return
+   */
+  public ValueFormatter getValueFormatter() {
+
+    return valueFormatter;
+  }
+
 }
diff --git a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java
index 4ac80f6c..2d4249b0 100644
--- a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java
+++ b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java
@@ -75,7 +75,7 @@ public final class QuickChart {
     Chart chart = new Chart(WIDTH, HEIGHT);
 
     // Customize Chart
-    chart.setTitle(chartTitle);
+    chart.setChartTitle(chartTitle);
     chart.setXAxisTitle(xTitle);
     chart.setYAxisTitle(yTitle);
 
@@ -111,7 +111,7 @@ public final class QuickChart {
     Chart chart = new Chart(WIDTH, HEIGHT);
 
     // Customize Chart
-    chart.setTitle(chartTitle);
+    chart.setChartTitle(chartTitle);
     chart.setXAxisTitle(xTitle);
     chart.setYAxisTitle(yTitle);
 
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java
index e3bcc2c2..e40618ea 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java
@@ -142,7 +142,7 @@ public class Axis implements IChartPart {
       // Axis title
       double titleHeight = 0.0;
       if (axisPair.chart.getStyleManager().isxAxisTitleVisible()) {
-        TextLayout textLayout = new TextLayout(axisTitle.getText(), axisTick.axis.axisPair.chart.getStyleManager().getAxisTitleFont(), new FontRenderContext(null, true, false));
+        TextLayout textLayout = new TextLayout(axisTitle.text, axisTick.axis.axisPair.chart.getStyleManager().getAxisTitleFont(), new FontRenderContext(null, true, false));
         Rectangle rectangle = textLayout.getPixelBounds(null, 0, 0);
         titleHeight = rectangle.getHeight() + axisTick.axis.axisPair.chart.getStyleManager().getAxisTitlePadding();
       }
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
index 20207578..9ecf6fc4 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java
@@ -26,7 +26,6 @@ import java.util.TimeZone;
 import com.xeiam.xchart.internal.chartpart.Axis.AxisType;
 import com.xeiam.xchart.internal.chartpart.Axis.Direction;
 import com.xeiam.xchart.internal.interfaces.IChartPart;
-import com.xeiam.xchart.internal.misc.AxisValueFormatterUtil;
 
 /**
  * An axis tick
@@ -75,7 +74,8 @@ public class AxisTick implements IChartPart {
   /**
    * Constructor
    * 
-   * @param axis the axis
+   * @param axis
+   * @param isVisible
    */
   protected AxisTick(Axis axis, boolean isVisible) {
 
@@ -83,7 +83,6 @@ public class AxisTick implements IChartPart {
     this.isVisible = isVisible;
     axisTickLabels = new AxisTickLabels(this);
     axisTickMarks = new AxisTickMarks(this);
-
   }
 
   @Override
@@ -255,11 +254,11 @@ public class AxisTick implements IChartPart {
 
     if (axis.axisType == AxisType.NUMBER) {
 
-      return AxisValueFormatterUtil.formatNumber(value, normalDecimalPattern, scientificDecimalPattern, locale);
+      return axis.axisPair.chart.getValueFormatter().formatNumber(value);
 
     } else {
 
-      return AxisValueFormatterUtil.formatDateValue(value, axis.min, axis.max, datePattern, locale, timezone);
+      return axis.axisPair.chart.getValueFormatter().formatDateValue(value, axis.min, axis.max);
     }
 
   }
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java
index 1acf0741..4eb497e3 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java
@@ -76,11 +76,13 @@ public class AxisTickMarks implements IChartPart {
             + (int) (axisTick.axis.getPaintZone().getHeight() - tickLocation));
 
       }
+
       // Line
       if (axisTick.axis.axisPair.chart.getStyleManager().isAxisTicksLineVisible()) {
         g.drawLine(xOffset + axisTick.axis.axisPair.chart.getStyleManager().getAxisTickMarkLength(), yOffset, xOffset + axisTick.axis.axisPair.chart.getStyleManager().getAxisTickMarkLength(), yOffset
             + (int) axisTick.axis.getPaintZone().getHeight());
       }
+
       // bounds
       bounds = new Rectangle(xOffset, yOffset, axisTick.axis.axisPair.chart.getStyleManager().getAxisTickMarkLength(), (int) axisTick.axis.getPaintZone().getHeight());
       // g.setColor(Color.yellow);
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java
index fa0391a6..95d4dc69 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java
@@ -32,7 +32,7 @@ public class AxisTitle implements IChartPart {
   private final Axis axis;
 
   /** the title text */
-  protected String text = ""; // default to ""
+  public String text = ""; // default to ""
 
   /** the bounds */
   private Rectangle bounds;
@@ -47,16 +47,6 @@ public class AxisTitle implements IChartPart {
     this.axis = axis;
   }
 
-  protected String getText() {
-
-    return text;
-  }
-
-  public void setText(String text) {
-
-    this.text = text;
-  }
-
   @Override
   public Rectangle getBounds() {
 
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java
index 654db3bd..3a15ac5a 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java
@@ -47,6 +47,11 @@ public class ChartTitle implements IChartPart {
     this.chart = chart;
   }
 
+  /**
+   * set the chart title's text
+   * 
+   * @param text
+   */
   public void setText(String text) {
 
     if (text.trim().equalsIgnoreCase("")) {
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContent.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContent.java
index b9749e41..0d21bb9c 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContent.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContent.java
@@ -18,6 +18,7 @@ package com.xeiam.xchart.internal.chartpart;
 import java.awt.BasicStroke;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
+import java.awt.Stroke;
 import java.math.BigDecimal;
 import java.util.Collection;
 import java.util.Date;
@@ -36,6 +37,8 @@ public class PlotContent implements IChartPart {
   /** parent */
   private Plot plot;
 
+  Stroke errorBarStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
+
   /**
    * Constructor
    * 
@@ -145,8 +148,8 @@ public class PlotContent implements IChartPart {
 
         // paint errorbar
         if (errorBars != null) {
-          g.setColor(plot.chart.getStyleManager().getChartBordersColor());
-          g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+          g.setColor(plot.chart.getStyleManager().getErrorBarsColor());
+          g.setStroke(errorBarStroke);
           int bottom = (int) (-1 * bounds.getHeight() * eb / (yMax.subtract(yMin).doubleValue()));
           int top = (int) (bounds.getHeight() * eb / (yMax.subtract(yMin).doubleValue()));
           g.drawLine(xOffset, yOffset + bottom, xOffset, yOffset + top);
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java
index 146f766b..d0ab69f6 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java
+++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java
@@ -16,13 +16,11 @@
 package com.xeiam.xchart.internal.chartpart;
 
 import java.awt.BasicStroke;
-import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.util.List;
 
 import com.xeiam.xchart.internal.interfaces.IChartPart;
-import com.xeiam.xchart.style.ChartColor;
 
 /**
  * @author timmolter
@@ -32,14 +30,8 @@ public class PlotSurface implements IChartPart {
   /** parent */
   private Plot plot;
 
-  /** the gridLines Color */
-  private Color gridLinesColor;
-
-  /** the background color */
-  private Color foregroundColor;
-
   /** the line style */
-  private BasicStroke stroke;
+  private BasicStroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] { 3.0f, 3.0f }, 0.0f);
 
   /**
    * Constructor
@@ -49,9 +41,6 @@ public class PlotSurface implements IChartPart {
   protected PlotSurface(Plot plot) {
 
     this.plot = plot;
-    gridLinesColor = ChartColor.getAWTColor(ChartColor.GREY); // default gridLines color
-    foregroundColor = ChartColor.getAWTColor(ChartColor.LIGHT_GREY); // default foreground Color color
-    stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] { 3.0f, 3.0f }, 0.0f);
   }
 
   @Override
@@ -65,9 +54,9 @@ public class PlotSurface implements IChartPart {
 
     Rectangle bounds = plot.getBounds();
 
-    // paint foreground
+    // paint plot background
     Rectangle backgroundRectangle = new Rectangle((int) bounds.getX() - 1, (int) bounds.getY(), (int) (bounds.getWidth()), (int) bounds.getHeight());
-    g.setColor(foregroundColor);
+    g.setColor(plot.chart.getStyleManager().getPlotBackgroundColor());
     g.fill(backgroundRectangle);
     Rectangle borderRectangle = new Rectangle((int) bounds.getX() - 1, (int) bounds.getY(), (int) (bounds.getWidth()), (int) bounds.getHeight());
     g.setColor(plot.chart.getStyleManager().getChartBordersColor());
@@ -75,13 +64,14 @@ public class PlotSurface implements IChartPart {
 
     // paint grid lines
     if (plot.chart.getStyleManager().isPlotGridLinesVisible()) {
+
       // horizontal
       List<Integer> yAxisTickLocations = plot.chart.axisPair.yAxis.axisTick.tickLocations;
       for (int i = 0; i < yAxisTickLocations.size(); i++) {
 
         int tickLocation = yAxisTickLocations.get(i);
 
-        g.setColor(gridLinesColor);
+        g.setColor(plot.chart.getStyleManager().getPlotGridLinesColor());
         g.setStroke(stroke);
         // System.out.println("bounds.getY()= " + bounds.getY());
         g.drawLine((int) bounds.getX(), (int) (bounds.getY() + bounds.getHeight() - tickLocation), (int) (bounds.getX() + bounds.getWidth() - 2),
@@ -94,7 +84,7 @@ public class PlotSurface implements IChartPart {
 
         int tickLocation = xAxisTickLocations.get(i);
 
-        g.setColor(gridLinesColor);
+        g.setColor(plot.chart.getStyleManager().getPlotGridLinesColor());
         g.setStroke(stroke);
 
         g.drawLine((int) (bounds.getX() + tickLocation - 1), (int) (bounds.getY() + 1), (int) (bounds.getX() + tickLocation - 1), (int) (bounds.getY() + bounds.getHeight() - 1));
@@ -102,20 +92,4 @@ public class PlotSurface implements IChartPart {
     }
   }
 
-  /**
-   * @param gridLinesColor the gridLinesColor to set
-   */
-  public void setGridLinesColor(Color gridLinesColor) {
-
-    this.gridLinesColor = gridLinesColor;
-  }
-
-  /**
-   * @param foregroundColor the foregroundColor to set
-   */
-  public void setForegroundColor(Color foregroundColor) {
-
-    this.foregroundColor = foregroundColor;
-  }
-
 }
diff --git a/xchart/src/main/java/com/xeiam/xchart/style/StyleManager.java b/xchart/src/main/java/com/xeiam/xchart/style/StyleManager.java
index 6988a744..cccfe424 100644
--- a/xchart/src/main/java/com/xeiam/xchart/style/StyleManager.java
+++ b/xchart/src/main/java/com/xeiam/xchart/style/StyleManager.java
@@ -66,6 +66,11 @@ public class StyleManager {
 
   // Chart Plot Area ///////////////////////////////
   private boolean isPlotGridLinesVisible;
+  private Color plotBackgroundColor;
+  private Color plotGridLinesColor;
+
+  // Error Bars ///////////////////////////////
+  private Color errorBarsColor;
 
   /**
    * Constructor
@@ -108,6 +113,11 @@ public class StyleManager {
 
     // Chart Plot Area ///////////////////////////////
     isPlotGridLinesVisible = theme.isPlotGridLinesVisible();
+    plotBackgroundColor = theme.getPlotBackgroundColor();
+    plotGridLinesColor = theme.getPlotGridLinesColor();
+
+    // Error Bars ///////////////////////////////
+    errorBarsColor = theme.getErrorBarsColor();
   }
 
   /**
@@ -486,4 +496,51 @@ public class StyleManager {
 
     return isPlotGridLinesVisible;
   }
+
+  /**
+   * set the plot area's background color
+   * 
+   * @param plotBackgroundColor
+   */
+  public void setPlotBackgroundColor(Color plotBackgroundColor) {
+
+    this.plotBackgroundColor = plotBackgroundColor;
+  }
+
+  public Color getPlotBackgroundColor() {
+
+    return plotBackgroundColor;
+  }
+
+  /**
+   * set the plot area's grid lines color
+   * 
+   * @param plotGridLinesColor
+   */
+  public void setPlotGridLinesColor(Color plotGridLinesColor) {
+
+    this.plotGridLinesColor = plotGridLinesColor;
+  }
+
+  public Color getPlotGridLinesColor() {
+
+    return plotGridLinesColor;
+  }
+
+  // Error Bars ///////////////////////////////
+
+  /**
+   * Sets the color of the error bars
+   * 
+   * @param errorBarsColor
+   */
+  public void setErrorBarsColor(Color errorBarsColor) {
+
+    this.errorBarsColor = errorBarsColor;
+  }
+
+  public Color getErrorBarsColor() {
+
+    return errorBarsColor;
+  }
 }
diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/misc/AxisValueFormatterUtil.java b/xchart/src/main/java/com/xeiam/xchart/style/ValueFormatter.java
similarity index 52%
rename from xchart/src/main/java/com/xeiam/xchart/internal/misc/AxisValueFormatterUtil.java
rename to xchart/src/main/java/com/xeiam/xchart/style/ValueFormatter.java
index 087c1284..19b15d42 100644
--- a/xchart/src/main/java/com/xeiam/xchart/internal/misc/AxisValueFormatterUtil.java
+++ b/xchart/src/main/java/com/xeiam/xchart/style/ValueFormatter.java
@@ -19,7 +19,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-package com.xeiam.xchart.internal.misc;
+package com.xeiam.xchart.style;
 
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
@@ -32,13 +32,13 @@ import java.util.concurrent.TimeUnit;
 /**
  * @author timmolter
  */
-public class AxisValueFormatterUtil {
+public class ValueFormatter {
 
-  private static final String NORMAL_DECIMAL_PATTERN = "#.####";
-  private static final String SCIENTIFIC_DECIMAL_PATTERN = "0.##E0";
-  private static final String DATE_PATTERN = "HHmmss";
-  private static final Locale LOCALE = Locale.getDefault();
-  private static final TimeZone TIMEZONE = TimeZone.getDefault();
+  private String normalDecimalPattern;
+  private String scientificDecimalPattern;
+  private String datePattern;
+  private Locale locale;
+  private TimeZone timezone;
 
   private static final long SEC_SCALE = TimeUnit.SECONDS.toMillis(1L);
   private static final long MIN_SCALE = TimeUnit.MINUTES.toMillis(1L);
@@ -51,35 +51,37 @@ public class AxisValueFormatterUtil {
   /**
    * Constructor
    */
-  private AxisValueFormatterUtil() {
+  public ValueFormatter() {
 
+    normalDecimalPattern = "#.####";
+    scientificDecimalPattern = "0.##E0";
+    datePattern = "HHmmss";
+    locale = Locale.getDefault();
+    timezone = TimeZone.getDefault();
   }
 
   /**
    * Format a number value, if the override patterns are null, it uses defaults
    * 
    * @param value
-   * @param normalDecimalPatternOverride
-   * @param scientificDecimalPatternOverride
-   * @param localeOverride
-   * @return the formatted number as a String
+   * @return
    */
-  public static String formatNumber(BigDecimal value, String normalDecimalPatternOverride, String scientificDecimalPatternOverride, Locale localeOverride) {
+  public String formatNumber(BigDecimal value) {
 
-    NumberFormat numberFormat = NumberFormat.getNumberInstance(localeOverride == null ? LOCALE : localeOverride);
+    NumberFormat numberFormat = NumberFormat.getNumberInstance(locale);
 
     BigDecimal absoluteValue = value.abs();
 
     if (absoluteValue.compareTo(new BigDecimal("10000.000001")) == -1 && absoluteValue.compareTo(new BigDecimal(".0009999999")) == 1 || BigDecimal.ZERO.compareTo(value) == 0) {
 
       DecimalFormat normalFormat = (DecimalFormat) numberFormat;
-      normalFormat.applyPattern(normalDecimalPatternOverride == null ? NORMAL_DECIMAL_PATTERN : normalDecimalPatternOverride);
+      normalFormat.applyPattern(normalDecimalPattern);
       return normalFormat.format(value);
 
     } else {
 
       DecimalFormat scientificFormat = (DecimalFormat) numberFormat;
-      scientificFormat.applyPattern(scientificDecimalPatternOverride == null ? SCIENTIFIC_DECIMAL_PATTERN : scientificDecimalPatternOverride);
+      scientificFormat.applyPattern(scientificDecimalPattern);
       return scientificFormat.format(value);
 
     }
@@ -92,42 +94,86 @@ public class AxisValueFormatterUtil {
    * @param value
    * @param min
    * @param max
-   * @param datePatternOverride
-   * @param localeOverride
-   * @return the formatted date value as a String
+   * @return
    */
-  public static String formatDateValue(BigDecimal value, BigDecimal min, BigDecimal max, String datePatternOverride, Locale localeOverride, TimeZone timeZoneOverride) {
-
-    // intelligently set datepattern if none is given
-    String datePattern = datePatternOverride;
-    if (datePatternOverride == null) {
-      datePattern = DATE_PATTERN;
-      long diff = max.subtract(min).longValue();
-
-      if (diff < SEC_SCALE) {
-        datePattern = "ss:S";
-      } else if (diff < MIN_SCALE) {
-        datePattern = "mm:ss";
-      } else if (diff < HOUR_SCALE) {
-        datePattern = "HH:mm";
-      } else if (diff < DAY_SCALE) {
-        datePattern = "EEE HH:mm";
-      } else if (diff < WEEK_SCALE) {
-        datePattern = "EEE";
-      } else if (diff < MONTH_SCALE) {
-        datePattern = "MMM-dd";
-      } else if (diff < YEAR_SCALE) {
-        datePattern = "yyyy:MMM";
-      } else {
-        datePattern = "yyyy";
-      }
-
+  public String formatDateValue(BigDecimal value, BigDecimal min, BigDecimal max) {
+
+    // intelligently set date pattern if none is given
+    long diff = max.subtract(min).longValue();
+
+    if (diff < SEC_SCALE) {
+      datePattern = "ss:S";
+    } else if (diff < MIN_SCALE) {
+      datePattern = "mm:ss";
+    } else if (diff < HOUR_SCALE) {
+      datePattern = "HH:mm";
+    } else if (diff < DAY_SCALE) {
+      datePattern = "EEE HH:mm";
+    } else if (diff < WEEK_SCALE) {
+      datePattern = "EEE";
+    } else if (diff < MONTH_SCALE) {
+      datePattern = "MMM-dd";
+    } else if (diff < YEAR_SCALE) {
+      datePattern = "yyyy:MMM";
+    } else {
+      datePattern = "yyyy";
     }
 
-    SimpleDateFormat simpleDateformat = new SimpleDateFormat(datePattern, localeOverride == null ? LOCALE : localeOverride);
-    simpleDateformat.setTimeZone(timeZoneOverride == null ? TIMEZONE : timeZoneOverride);
+    SimpleDateFormat simpleDateformat = new SimpleDateFormat(datePattern, locale);
+    simpleDateformat.setTimeZone(timezone);
     simpleDateformat.applyPattern(datePattern);
     return simpleDateformat.format(value.longValueExact());
 
   }
+
+  /**
+   * Set the decimal formatter for all tick labels
+   * 
+   * @param pattern - the pattern describing the decimal format
+   */
+  public void setNormalDecimalPattern(String normalDecimalPattern) {
+
+    this.normalDecimalPattern = normalDecimalPattern;
+  }
+
+  /**
+   * Set the scientific notation formatter for all tick labels
+   * 
+   * @param pattern - the pattern describing the scientific notation format
+   */
+  public void setScientificDecimalPattern(String scientificDecimalPattern) {
+
+    this.scientificDecimalPattern = scientificDecimalPattern;
+  }
+
+  /**
+   * Set the String formatter for Data x-axis
+   * 
+   * @param pattern - the pattern describing the date and time format
+   */
+  public void setDatePattern(String datePattern) {
+
+    this.datePattern = datePattern;
+  }
+
+  /**
+   * Set the locale to use for rendering the chart
+   * 
+   * @param locale - the locale to use when formatting Strings and dates for the axis tick labels
+   */
+  public void setLocale(Locale locale) {
+
+    this.locale = locale;
+  }
+
+  /**
+   * Set the timezone to use for formatting Date axis tick labels
+   * 
+   * @param timezone the timezone to use when formatting date data
+   */
+  public void setTimezone(TimeZone timezone) {
+
+    this.timezone = timezone;
+  }
+
 }
diff --git a/xchart/src/main/java/com/xeiam/xchart/style/theme/Theme.java b/xchart/src/main/java/com/xeiam/xchart/style/theme/Theme.java
index b31cefa2..0cac20f3 100644
--- a/xchart/src/main/java/com/xeiam/xchart/style/theme/Theme.java
+++ b/xchart/src/main/java/com/xeiam/xchart/style/theme/Theme.java
@@ -83,4 +83,12 @@ public interface Theme {
 
   public boolean isPlotGridLinesVisible();
 
+  public Color getPlotBackgroundColor();
+
+  public Color getPlotGridLinesColor();
+
+  // Error Bars ///////////////////////////////
+
+  public Color getErrorBarsColor();
+
 }
diff --git a/xchart/src/main/java/com/xeiam/xchart/style/theme/XChartTheme.java b/xchart/src/main/java/com/xeiam/xchart/style/theme/XChartTheme.java
index 86d69e42..c8694e8b 100644
--- a/xchart/src/main/java/com/xeiam/xchart/style/theme/XChartTheme.java
+++ b/xchart/src/main/java/com/xeiam/xchart/style/theme/XChartTheme.java
@@ -172,4 +172,25 @@ public class XChartTheme implements Theme {
 
     return true;
   }
+
+  @Override
+  public Color getPlotBackgroundColor() {
+
+    return ChartColor.getAWTColor(ChartColor.LIGHT_GREY);
+  }
+
+  @Override
+  public Color getPlotGridLinesColor() {
+
+    return ChartColor.getAWTColor(ChartColor.GREY);
+  }
+
+  // Error Bars ///////////////////////////////
+
+  @Override
+  public Color getErrorBarsColor() {
+
+    return ChartColor.getAWTColor(ChartColor.DARK_GREY);
+  }
+
 }
diff --git a/xchart/src/test/java/com/xeiam/xchart/ValueFormatTest.java b/xchart/src/test/java/com/xeiam/xchart/ValueFormatterTest.java
similarity index 68%
rename from xchart/src/test/java/com/xeiam/xchart/ValueFormatTest.java
rename to xchart/src/test/java/com/xeiam/xchart/ValueFormatterTest.java
index 25b13ddb..3c266f11 100644
--- a/xchart/src/test/java/com/xeiam/xchart/ValueFormatTest.java
+++ b/xchart/src/test/java/com/xeiam/xchart/ValueFormatterTest.java
@@ -30,68 +30,71 @@ import java.util.TimeZone;
 
 import org.junit.Test;
 
-import com.xeiam.xchart.internal.misc.AxisValueFormatterUtil;
+import com.xeiam.xchart.style.ValueFormatter;
 
 /**
  * @author timmolter
  */
-public class ValueFormatTest {
+public class ValueFormatterTest {
 
   private final Locale locale = Locale.US;
 
   @Test
   public void testNumberFormatting() {
 
+    ValueFormatter axisTickLabelFormatter = new ValueFormatter();
+
     // big
+    axisTickLabelFormatter.setLocale(locale);
 
     BigDecimal value = new BigDecimal("1");
-    String stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    String stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("1"));
 
     value = new BigDecimal(1000L);
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("1000"));
 
     value = new BigDecimal("9999");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("9999"));
 
     value = new BigDecimal(20000L);
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("2E4"));
 
     value = new BigDecimal("200.23");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("200.23"));
 
     // small
 
     value = new BigDecimal("0.01");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0.01"));
 
     value = new BigDecimal("0.001");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0.001"));
 
     value = new BigDecimal("0.0012");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0.0012"));
 
     value = new BigDecimal("0.0001");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("1E-4"));
 
     value = new BigDecimal(".00012");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("1.2E-4"));
 
     value = new BigDecimal("0.0");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0"));
 
     value = new BigDecimal("0");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, locale);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0"));
 
     // other case
@@ -107,21 +110,24 @@ public class ValueFormatTest {
     // assertThat(stringValue, equalTo("0.01"));
 
     // non-default
+    axisTickLabelFormatter.setLocale(Locale.GERMANY);
 
     value = new BigDecimal("0.01");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, Locale.GERMANY);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("0,01"));
 
     value = new BigDecimal("200.23");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, null, Locale.GERMANY);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("200,23"));
 
+    axisTickLabelFormatter.setNormalDecimalPattern("#.#");
     value = new BigDecimal("200.23");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, "#.#", null, Locale.GERMANY);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("200,2"));
 
+    axisTickLabelFormatter.setScientificDecimalPattern("0.#E0");
     value = new BigDecimal("2009764.23");
-    stringValue = AxisValueFormatterUtil.formatNumber(value, null, "0.#E0", Locale.GERMANY);
+    stringValue = axisTickLabelFormatter.formatNumber(value);
     assertThat(stringValue, equalTo("2E6"));
 
   }
@@ -129,62 +135,67 @@ public class ValueFormatTest {
   @Test
   public void testDateFormatting() {
 
+    ValueFormatter axisTickLabelFormatter = new ValueFormatter();
+
     TimeZone timeZone = TimeZone.getTimeZone("UTC");
 
+    axisTickLabelFormatter.setLocale(locale);
+    axisTickLabelFormatter.setTimezone(timeZone);
+
     // ms
     BigDecimal value = new BigDecimal(1358108105531L);
     BigDecimal min = new BigDecimal(1358108105100L);
     BigDecimal max = new BigDecimal(1358108105900L);
-    String stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    String stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("05:531"));
 
     // sec
     value = new BigDecimal(1358108105000L);
     min = new BigDecimal(1358108101000L);
     max = new BigDecimal(1358108109000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("15:05"));
 
     // min
     value = new BigDecimal(1358111750000L);
     min = new BigDecimal(1358111690000L);
     max = new BigDecimal(1358111870000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("21:15"));
 
     // hour
     value = new BigDecimal(1358111870000L);
     min = new BigDecimal(1358101070000L);
     max = new BigDecimal(1358115470000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("Sun 21:17"));
 
     // day
     value = new BigDecimal(1358112317000L);
     min = new BigDecimal(1357939517000L);
     max = new BigDecimal(1358285117000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("Sun"));
 
     // week
     value = new BigDecimal(1358112317000L);
     min = new BigDecimal(1357075517000L);
     max = new BigDecimal(1359149117000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("Jan-13"));
 
     // month
     value = new BigDecimal(1358112838000L);
     min = new BigDecimal(1354397638000L);
     max = new BigDecimal(1361223238000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("2013:Jan"));
 
     // year
     value = new BigDecimal(1358113402000L);
     min = new BigDecimal(1263419002000L);
     max = new BigDecimal(1421185402000L);
-    stringValue = AxisValueFormatterUtil.formatDateValue(value, min, max, null, locale, timeZone);
+    stringValue = axisTickLabelFormatter.formatDateValue(value, min, max);
     assertThat(stringValue, equalTo("2013"));
 
   }
-- 
GitLab