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

added Theme interface

parent 4b47f980
No related branches found
No related tags found
No related merge requests found
Showing
with 105 additions and 41 deletions
......@@ -20,8 +20,8 @@ import java.util.Collection;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.appearance.Series;
import com.xeiam.xchart.appearance.SeriesMarker;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Manual Data
......
......@@ -17,10 +17,10 @@ package com.xeiam.xchart.demo.charts;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesColor;
import com.xeiam.xchart.style.SeriesLineStyle;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Plots Hundreds of Series on One Plot
......
......@@ -20,10 +20,10 @@ import java.util.Collection;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesColor;
import com.xeiam.xchart.style.SeriesLineStyle;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Sine wave with customized series style
......
......@@ -25,7 +25,7 @@ import java.util.TimeZone;
import com.xeiam.xchart.Chart;
import com.xeiam.xchart.SwingWrapper;
import com.xeiam.xchart.appearance.Series;
import com.xeiam.xchart.style.Series;
/**
* Date Axis
......
......@@ -20,10 +20,10 @@ import java.util.Collection;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesColor;
import com.xeiam.xchart.style.SeriesLineStyle;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Error bars
......
......@@ -27,11 +27,11 @@ import java.util.Locale;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.ChartColor;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesColor;
import com.xeiam.xchart.style.SeriesLineStyle;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Extensive chart customization
......
......@@ -25,12 +25,13 @@ 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;
import com.xeiam.xchart.internal.chartpart.Plot;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.StyleManager;
import com.xeiam.xchart.style.theme.Theme;
/**
* An XChart Chart
......@@ -476,4 +477,15 @@ public class Chart {
return styleManager;
}
/**
* Set the theme the Chart's style manager should use
*
* @param theme
*/
public void setTheme(Theme theme) {
styleManager.setTheme(theme);
}
}
......@@ -17,8 +17,8 @@ package com.xeiam.xchart;
import java.util.Collection;
import com.xeiam.xchart.appearance.Series;
import com.xeiam.xchart.appearance.SeriesMarker;
import com.xeiam.xchart.style.Series;
import com.xeiam.xchart.style.SeriesMarker;
/**
* A convenience class for making Charts with one line of code
......
......@@ -25,10 +25,10 @@ import java.util.LinkedHashMap;
import java.util.Map;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.Series;
/**
* @author timmolter
......
......@@ -24,11 +24,11 @@ import java.awt.font.TextLayout;
import java.util.Map;
import com.xeiam.xchart.Chart;
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;
import com.xeiam.xchart.style.ChartColor;
import com.xeiam.xchart.style.Series;
/**
* @author timmolter
......
......@@ -24,9 +24,9 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Map;
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.style.Series;
/**
* @author timmolter
......
......@@ -21,9 +21,9 @@ import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.List;
import com.xeiam.xchart.appearance.ChartColor;
import com.xeiam.xchart.internal.interfaces.IChartPart;
import com.xeiam.xchart.internal.interfaces.IHideable;
import com.xeiam.xchart.style.ChartColor;
/**
* @author timmolter
......
......@@ -25,9 +25,9 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import com.xeiam.xchart.appearance.SeriesColor;
import com.xeiam.xchart.appearance.SeriesLineStyle;
import com.xeiam.xchart.appearance.SeriesMarker;
import com.xeiam.xchart.style.SeriesColor;
import com.xeiam.xchart.style.SeriesLineStyle;
import com.xeiam.xchart.style.SeriesMarker;
/**
* Cycles through the different colors, markers, and strokes in a predetermined way
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import java.awt.Color;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import java.awt.BasicStroke;
import java.awt.Color;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import java.awt.Color;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import java.awt.BasicStroke;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import com.xeiam.xchart.internal.markers.Circle;
import com.xeiam.xchart.internal.markers.Diamond;
......
......@@ -19,15 +19,20 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xeiam.xchart.appearance;
package com.xeiam.xchart.style;
import java.awt.Color;
import com.xeiam.xchart.style.theme.Theme;
import com.xeiam.xchart.style.theme.XChartTheme;
/**
* @author timmolter
*/
public class StyleManager {
private Theme theme = new XChartTheme();
private Color backgroundColor;
public Color bordersColor;
public Color fontColor;
......@@ -37,9 +42,19 @@ public class StyleManager {
*/
public StyleManager() {
backgroundColor = ChartColor.getAWTColor(ChartColor.GREY);
bordersColor = ChartColor.getAWTColor(ChartColor.DARK_GREY);
fontColor = ChartColor.getAWTColor(ChartColor.BLACK);
backgroundColor = theme.getChartBackgroundColor();
bordersColor = theme.getChartBordersColor();
fontColor = theme.getChartFontColor();
}
/**
* Set the theme the style manager should use
*
* @param theme
*/
public void setTheme(Theme theme) {
this.theme = theme;
}
/**
......
/**
* 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.style.theme;
import java.awt.Color;
/**
* @author timmolter
*/
public interface Theme {
public Color getChartBackgroundColor();
public Color getChartBordersColor();
public Color getChartFontColor();
}
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