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 4a35d8d96f2ffbe22ea4e498874372e39210f4cf..409d81da12ea0907e53f3304c332c86449024928 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 @@ -19,9 +19,9 @@ import java.util.Arrays; import java.util.Collection; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; -import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Manual Data 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 77704de21c7e98f2a3f6e23ccae190056056a167..269e4d05feb89da1396c56dcdcc8a388af2591f3 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 @@ -16,11 +16,11 @@ package com.xeiam.xchart.demo.charts; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; -import com.xeiam.xchart.SeriesColor; -import com.xeiam.xchart.SeriesLineStyle; -import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesColor; +import com.xeiam.xchart.appearance.SeriesLineStyle; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Plots Hundreds of Series on One Plot 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 038546641eeeeeb2268c7f20dcc3ce9721e613b4..2a60a46afa021e68fea17dd44d7776f6cc379ab0 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 @@ -19,11 +19,11 @@ import java.util.ArrayList; import java.util.Collection; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; -import com.xeiam.xchart.SeriesColor; -import com.xeiam.xchart.SeriesLineStyle; -import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesColor; +import com.xeiam.xchart.appearance.SeriesLineStyle; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Sine wave with customized series style 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 433e9bf19fcab863d14b20abe21c8abdefd54c66..37be3ffaec5b1d9c2e765023586b57fe8896cc68 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 @@ -24,8 +24,8 @@ import java.util.Date; import java.util.TimeZone; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.Series; /** * Date Axis diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example8.java b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example8.java index c6c23fddcd3b37d0e744957b35e373d678aea584..bc93ee1ddfe62e8a14ea2dae3a62a2f9ed2068cd 100644 --- a/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example8.java +++ b/xchart-demo/src/main/java/com/xeiam/xchart/demo/charts/Example8.java @@ -19,11 +19,11 @@ import java.util.ArrayList; import java.util.Collection; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; -import com.xeiam.xchart.SeriesColor; -import com.xeiam.xchart.SeriesLineStyle; -import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesColor; +import com.xeiam.xchart.appearance.SeriesLineStyle; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Error bars 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 c8d2576ff462acda1af8b1fdc1c8d582909969de..0eb6fe628da7fa0b8ccc1a0e861fe2659ed39dc7 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 @@ -26,12 +26,12 @@ import java.util.Date; import java.util.Locale; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.ChartColor; -import com.xeiam.xchart.Series; -import com.xeiam.xchart.SeriesColor; -import com.xeiam.xchart.SeriesLineStyle; -import com.xeiam.xchart.SeriesMarker; import com.xeiam.xchart.SwingWrapper; +import com.xeiam.xchart.appearance.ChartColor; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesColor; +import com.xeiam.xchart.appearance.SeriesLineStyle; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Extensive chart customization @@ -76,10 +76,10 @@ public class Example9 implements ExampleChart { chart.setYAxisTitle("Y"); chart.setForegroundColor(ChartColor.getAWTColor(ChartColor.GREY)); chart.setGridLinesColor(new Color(255, 255, 255)); - chart.setBackgroundColor(Color.WHITE); + chart.getStyleManager().setBackgroundColor(Color.WHITE); chart.setLegendBackgroundColor(Color.PINK); - chart.setLinesColor(Color.GREEN); - chart.setFontColor(Color.MAGENTA); + chart.getStyleManager().setBordersColor(Color.GREEN); + chart.getStyleManager().setFontColor(Color.MAGENTA); chart.setTitleFont(new Font(Font.MONOSPACED, Font.BOLD, 24)); chart.setLegendFont(new Font(Font.SERIF, Font.PLAIN, 18)); chart.setAxisTitleFont(new Font(Font.SANS_SERIF, Font.ITALIC, 18)); diff --git a/xchart/src/main/java/com/xeiam/xchart/Chart.java b/xchart/src/main/java/com/xeiam/xchart/Chart.java index c955a7b2fa9a3a166342f5cb30280eb64e5b461e..3167c92abce65b8ff58489563b9e4eb89ce8d246 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Chart.java +++ b/xchart/src/main/java/com/xeiam/xchart/Chart.java @@ -25,6 +25,8 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.StyleManager; import com.xeiam.xchart.internal.chartpart.AxisPair; import com.xeiam.xchart.internal.chartpart.ChartTitle; import com.xeiam.xchart.internal.chartpart.Legend; @@ -39,12 +41,12 @@ public class Chart { public int width; public int height; - private Color backgroundColor; - public Color bordersColor; - public Color fontColor; + + private StyleManager styleManager = new StyleManager(); public final static int CHART_PADDING = 10; + // Chart Parts public ChartTitle chartTitle = new ChartTitle(this); public Legend chartLegend = new Legend(this); public AxisPair axisPair = new AxisPair(this); @@ -60,9 +62,7 @@ public class Chart { this.width = width; this.height = height; - backgroundColor = ChartColor.getAWTColor(ChartColor.GREY); - bordersColor = ChartColor.getAWTColor(ChartColor.DARK_GREY); - fontColor = ChartColor.getAWTColor(ChartColor.BLACK); + } /** @@ -103,7 +103,7 @@ public class Chart { } g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // global rendering hint - g.setColor(backgroundColor); + g.setColor(styleManager.getBackgroundColor()); g.fillRect(0, 0, width, height); chartTitle.paint(g); @@ -340,16 +340,6 @@ public class Chart { this.plot.plotSurface.setVisible(isVisible); } - /** - * Set the chart background color - the part around the edge of the chart - * - * @param color - */ - public void setBackgroundColor(Color color) { - - this.backgroundColor = color; - } - /** * Set the chart foreground color - the part the series are drawn on * @@ -380,26 +370,6 @@ public class Chart { this.chartLegend.backgroundColor = color; } - /** - * Sets the color of the plot border, legend border, tick marks, and error bars - * - * @param color - */ - public void setLinesColor(Color color) { - - this.bordersColor = color; - } - - /** - * Set the chart font color - * - * @param color - */ - public void setFontColor(Color color) { - - this.fontColor = color; - } - /** * Set the chart title font * @@ -496,4 +466,14 @@ public class Chart { this.axisPair.yAxis.axisTick.timezone = timezone; } + /** + * Gets the Chart's style manager, which can be used to customize the Chart's appearance + * + * @return the style manager + */ + public StyleManager getStyleManager() { + + return styleManager; + } + } diff --git a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java index 75931dec117ecadfa5ea1e84efb5823c6d3b6cb7..22ba2eb47d43776a0bb3fe1b612ecc51915cd88e 100644 --- a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java +++ b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java @@ -17,6 +17,9 @@ package com.xeiam.xchart; import java.util.Collection; +import com.xeiam.xchart.appearance.Series; +import com.xeiam.xchart.appearance.SeriesMarker; + /** * A convenience class for making Charts with one line of code * diff --git a/xchart/src/main/java/com/xeiam/xchart/ChartColor.java b/xchart/src/main/java/com/xeiam/xchart/appearance/ChartColor.java similarity index 97% rename from xchart/src/main/java/com/xeiam/xchart/ChartColor.java rename to xchart/src/main/java/com/xeiam/xchart/appearance/ChartColor.java index 36a967ea513519490ef0a42456fce6638fefd679..dffbfa85e7045f89e50b431f797e345b5f473d66 100644 --- a/xchart/src/main/java/com/xeiam/xchart/ChartColor.java +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/ChartColor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart; +package com.xeiam.xchart.appearance; import java.awt.Color; diff --git a/xchart/src/main/java/com/xeiam/xchart/Series.java b/xchart/src/main/java/com/xeiam/xchart/appearance/Series.java similarity index 99% rename from xchart/src/main/java/com/xeiam/xchart/Series.java rename to xchart/src/main/java/com/xeiam/xchart/appearance/Series.java index b49e1dcaf8a90f3fdc82595fe505622e0c513c65..3b05288f8ab06d5e415a9885d425234dfeeee75a 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Series.java +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/Series.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart; +package com.xeiam.xchart.appearance; import java.awt.BasicStroke; import java.awt.Color; diff --git a/xchart/src/main/java/com/xeiam/xchart/SeriesColor.java b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesColor.java similarity index 98% rename from xchart/src/main/java/com/xeiam/xchart/SeriesColor.java rename to xchart/src/main/java/com/xeiam/xchart/appearance/SeriesColor.java index 8640a462cc4e4726c1f502fbf561305903b433ad..f5994a6529b737dfe116c88165e0f8697d7b99c3 100644 --- a/xchart/src/main/java/com/xeiam/xchart/SeriesColor.java +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesColor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart; +package com.xeiam.xchart.appearance; import java.awt.Color; diff --git a/xchart/src/main/java/com/xeiam/xchart/SeriesLineStyle.java b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesLineStyle.java similarity index 98% rename from xchart/src/main/java/com/xeiam/xchart/SeriesLineStyle.java rename to xchart/src/main/java/com/xeiam/xchart/appearance/SeriesLineStyle.java index 1801ac0101ef911fea68b75d92149528b482ae35..b73d6d35806f59516fc46dd7d292ff4bda722fa5 100644 --- a/xchart/src/main/java/com/xeiam/xchart/SeriesLineStyle.java +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesLineStyle.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart; +package com.xeiam.xchart.appearance; import java.awt.BasicStroke; diff --git a/xchart/src/main/java/com/xeiam/xchart/SeriesMarker.java b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesMarker.java similarity index 97% rename from xchart/src/main/java/com/xeiam/xchart/SeriesMarker.java rename to xchart/src/main/java/com/xeiam/xchart/appearance/SeriesMarker.java index 04db9f0072b32b7683efad73004884b9e3dbcc53..e486620f97ab0a72a2b434829c2143630e9dab7f 100644 --- a/xchart/src/main/java/com/xeiam/xchart/SeriesMarker.java +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/SeriesMarker.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart; +package com.xeiam.xchart.appearance; import com.xeiam.xchart.internal.markers.Circle; import com.xeiam.xchart.internal.markers.Diamond; diff --git a/xchart/src/main/java/com/xeiam/xchart/appearance/StyleManager.java b/xchart/src/main/java/com/xeiam/xchart/appearance/StyleManager.java new file mode 100644 index 0000000000000000000000000000000000000000..64bcce889d908b2f44c9a6b348ecf1593ef12fef --- /dev/null +++ b/xchart/src/main/java/com/xeiam/xchart/appearance/StyleManager.java @@ -0,0 +1,90 @@ +/** + * 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.appearance; + +import java.awt.Color; + +/** + * @author timmolter + */ +public class StyleManager { + + private Color backgroundColor; + public Color bordersColor; + public Color fontColor; + + /** + * Constructor + */ + public StyleManager() { + + backgroundColor = ChartColor.getAWTColor(ChartColor.GREY); + bordersColor = ChartColor.getAWTColor(ChartColor.DARK_GREY); + fontColor = ChartColor.getAWTColor(ChartColor.BLACK); + } + + /** + * Set the chart background color - the part around the edge of the chart + * + * @param color + */ + public void setBackgroundColor(Color backgroundColor) { + + this.backgroundColor = backgroundColor; + } + + /** + * Sets the color of the plot border, legend border, tick marks, and error bars + * + * @param color + */ + public void setBordersColor(Color bordersColor) { + + this.bordersColor = bordersColor; + } + + /** + * Set the chart font color + * + * @param color + */ + public void setFontColor(Color fontColor) { + + this.fontColor = fontColor; + } + + public Color getBackgroundColor() { + + return backgroundColor; + } + + public Color getBordersColor() { + + return bordersColor; + } + + public Color getFontColor() { + + return fontColor; + } + +} diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java index 85e3cd317d256576bcc41ab8766f18bb22d41faf..6df987ba32cc2876a6a226fe36ad083f65c8d3cc 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java @@ -25,7 +25,7 @@ import java.util.LinkedHashMap; import java.util.Map; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.Series; +import com.xeiam.xchart.appearance.Series; import com.xeiam.xchart.internal.chartpart.Axis.AxisType; import com.xeiam.xchart.internal.interfaces.IChartPart; import com.xeiam.xchart.internal.misc.SeriesColorMarkerLineStyleCycler; diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java index 74dbd943f4a06f932bf0a90f8f53a24173572080..f0696f148de73f8f5bcf7ff3fae54d5958a0763a 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java @@ -60,7 +60,7 @@ public class AxisTickLabels implements IChartPart { bounds = new Rectangle(); g.setFont(font); - g.setColor(axisTick.axis.axisPair.chart.fontColor); + g.setColor(axisTick.axis.axisPair.chart.getStyleManager().getFontColor()); if (axisTick.axis.direction == Axis.Direction.Y) { // Y-Axis 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 9aca4a0e2517fe29b1b8fb82639b7396fff04495..a0dcfa1feb482beb8027f9475d9227d8f8b6d374 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 @@ -60,7 +60,7 @@ public class AxisTickMarks implements IChartPart { bounds = new Rectangle(); - g.setColor(axisTick.axis.axisPair.chart.bordersColor); + g.setColor(axisTick.axis.axisPair.chart.getStyleManager().getBordersColor()); if (axisTick.axis.direction == Axis.Direction.Y) { // Y-Axis @@ -72,7 +72,7 @@ public class AxisTickMarks implements IChartPart { int tickLocation = axisTick.tickLocations.get(i); - g.setColor(axisTick.axis.axisPair.chart.bordersColor); + g.setColor(axisTick.axis.axisPair.chart.getStyleManager().getBordersColor()); g.setStroke(stroke); g.drawLine(xOffset, yOffset + (int) (axisTick.axis.getPaintZone().getHeight() - tickLocation), xOffset + TICK_LENGTH, yOffset + (int) (axisTick.axis.getPaintZone().getHeight() - tickLocation)); @@ -96,7 +96,7 @@ public class AxisTickMarks implements IChartPart { int tickLocation = axisTick.tickLocations.get(i); - g.setColor(axisTick.axis.axisPair.chart.bordersColor); + g.setColor(axisTick.axis.axisPair.chart.getStyleManager().getBordersColor()); g.setStroke(stroke); g.drawLine(xOffset + tickLocation, yOffset, xOffset + tickLocation, yOffset - TICK_LENGTH); 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 4c9f84e7777cf6b17aea2c2dc22ad83bbc676bb3..2d5dde1ef52e5f4e4e6e6fbbdd242990c849faf7 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 @@ -100,7 +100,7 @@ public class AxisTitle implements IChartPart, IHideable { bounds = new Rectangle(); - g.setColor(axis.axisPair.chart.fontColor); + g.setColor(axis.axisPair.chart.getStyleManager().getFontColor()); g.setFont(font); if (axis.direction == Axis.Direction.Y) { 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 480ea6061392082b3798bb3a9595980ae797497c..ac50ea785df439c8c76571333913009d9c722bde 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 @@ -90,7 +90,7 @@ public class ChartTitle implements IChartPart, IHideable { // g.setColor(Color.green); // g.draw(bounds); - g.setColor(chart.fontColor); + g.setColor(chart.getStyleManager().getFontColor()); textLayout.draw(g, xOffset, yOffset); } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java index a1260406cf5b2d0a90198f7742517c9ac61f7cce..7084c0a44a343cebd4f8cdda21639df8c8c60855 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java @@ -24,8 +24,8 @@ import java.awt.font.TextLayout; import java.util.Map; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.ChartColor; -import com.xeiam.xchart.Series; +import com.xeiam.xchart.appearance.ChartColor; +import com.xeiam.xchart.appearance.Series; import com.xeiam.xchart.internal.interfaces.IChartPart; import com.xeiam.xchart.internal.interfaces.IHideable; import com.xeiam.xchart.internal.markers.Marker; @@ -111,7 +111,7 @@ public class Legend implements IChartPart, IHideable { int xOffset = chart.width - legendBoxWidth - Chart.CHART_PADDING; int yOffset = (int) ((chart.height - legendBoxHeight) / 2.0 + chart.chartTitle.getBounds().getY() + chart.chartTitle.getBounds().getHeight()); - g.setColor(chart.bordersColor); + g.setColor(chart.getStyleManager().getBordersColor()); g.drawRect(xOffset, yOffset, legendBoxWidth, legendBoxHeight); g.setColor(backgroundColor); g.fillRect(xOffset + 1, yOffset + 1, legendBoxWidth - 1, legendBoxHeight - 1); @@ -134,7 +134,7 @@ public class Legend implements IChartPart, IHideable { } // paint series name - g.setColor(chart.fontColor); + g.setColor(chart.getStyleManager().getFontColor()); TextLayout layout = new TextLayout(series.name, font, new FontRenderContext(null, true, false)); layout.draw(g, (float) (startx + Marker.SIZE + (Marker.SIZE * 1.5) + LEGEND_PADDING), (starty + Marker.SIZE)); starty = starty + legendTextContentMaxHeight + LEGEND_PADDING; 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 7dd8fa7c8637b28ad57ee06c597da134b200432d..d2970a87b948df80dbeeb09118bfb92cdcef5233 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 @@ -24,7 +24,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Map; -import com.xeiam.xchart.Series; +import com.xeiam.xchart.appearance.Series; import com.xeiam.xchart.internal.chartpart.Axis.AxisType; import com.xeiam.xchart.internal.interfaces.IChartPart; @@ -145,7 +145,7 @@ public class PlotContent implements IChartPart { // paint errorbar if (errorBars != null) { - g.setColor(plot.chart.bordersColor); + g.setColor(plot.chart.getStyleManager().getBordersColor()); g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); int bottom = (int) (-1 * bounds.getHeight() * eb / (yMax.subtract(yMin).doubleValue())); int top = (int) (bounds.getHeight() * eb / (yMax.subtract(yMin).doubleValue())); 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 6f51c6228b3718b30b0532ebc75a7dd3f3081b0e..29ad0049ea152f2a1120e9c516e47281a6c87dbb 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 @@ -21,7 +21,7 @@ import java.awt.Graphics2D; import java.awt.Rectangle; import java.util.List; -import com.xeiam.xchart.ChartColor; +import com.xeiam.xchart.appearance.ChartColor; import com.xeiam.xchart.internal.interfaces.IChartPart; import com.xeiam.xchart.internal.interfaces.IHideable; @@ -74,7 +74,7 @@ public class PlotSurface implements IChartPart, IHideable { g.setColor(foregroundColor); g.fill(backgroundRectangle); Rectangle borderRectangle = new Rectangle((int) bounds.getX() - 1, (int) bounds.getY(), (int) (bounds.getWidth()), (int) bounds.getHeight()); - g.setColor(plot.chart.bordersColor); + g.setColor(plot.chart.getStyleManager().getBordersColor()); g.draw(borderRectangle); // paint grid lines diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/misc/SeriesColorMarkerLineStyleCycler.java b/xchart/src/main/java/com/xeiam/xchart/internal/misc/SeriesColorMarkerLineStyleCycler.java index 15d674a3b6a140e1313e8cd93d7adc7affb8cebb..23166c8313d514097809db5ae2276378285cd7ec 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/misc/SeriesColorMarkerLineStyleCycler.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/misc/SeriesColorMarkerLineStyleCycler.java @@ -25,9 +25,9 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.Map; -import com.xeiam.xchart.SeriesColor; -import com.xeiam.xchart.SeriesLineStyle; -import com.xeiam.xchart.SeriesMarker; +import com.xeiam.xchart.appearance.SeriesColor; +import com.xeiam.xchart.appearance.SeriesLineStyle; +import com.xeiam.xchart.appearance.SeriesMarker; /** * Cycles through the different colors, markers, and strokes in a predetermined way