    001/* ===========================================================
    002 * Orson Charts : a 3D chart library for the Java(tm) platform
    003 * ===========================================================
    004 *
    005 * (C)opyright 2013-2016, by Object Refinery Limited.  All rights reserved.
    006 *
    007 * http://www.object-refinery.com/orsoncharts/index.html
    008 *
    009 * This program is free software: you can redistribute it and/or modify
    010 * it under the terms of the GNU General Public License as published by
    011 * the Free Software Foundation, either version 3 of the License, or
    012 * (at your option) any later version.
    013 *
    014 * This program is distributed in the hope that it will be useful,
    015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    017 * GNU General Public License for more details.
    018 *
    019 * You should have received a copy of the GNU General Public License
    020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    021 *
    022 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    023 * Other names may be trademarks of their respective owners.]
    024 *
    025 * If you do not wish to be bound by the terms of the GPL, an alternative
    026 * commercial license can be purchased.  For details, please see visit the
    027 * Orson Charts home page:
    028 *
    029 * http://www.object-refinery.com/orsoncharts/index.html
    030 *
    031 */
    032
    033package com.orsoncharts.style;
    034
    035import java.awt.Color;
    036import java.awt.Font;
    037import com.orsoncharts.Colors;
    038import com.orsoncharts.table.StandardRectanglePainter;
    039
    040/**
    041 * Some predefined chart styles.
    042 *
    043 * @since 1.2
    044 */
    045public class ChartStyles {
    046
    047    /**
    048     * Creates and returns a new instance of the "Orson 1" chart style.
    049     *
    050     * @return A chart style (never {@code null}).
    051     */
    052    public static ChartStyle createOrson1Style() {
    053        StandardChartStyle s = new StandardChartStyle();
    054        s.setStandardColors(Colors.createFancyLightColors());
    055        return s;
    056    }
    057
    058    /**
    059     * Creates and returns a new instance of the "Orson 2" chart style. This
    060     * style has a black background and uses shades of blue for the data
    061     * colors.
    062     *
    063     * @return A chart style (never {@code null}).
    064     */
    065    public static ChartStyle createOrson2Style() {
    066        StandardChartStyle s = new StandardChartStyle();
    067        Color bgcolor = new Color(50, 50, 50, 150);
    068        s.setTitleColor(Color.LIGHT_GRAY);
    069        s.setTitleBackgroundColor(bgcolor);
    070        s.setSubtitleColor(Color.LIGHT_GRAY);
    071        s.setSubtitleBackgroundColor(bgcolor);
    072        s.setChartBoxColor(new Color(200, 200, 255, 50));
    073        s.setSectionLabelColor(Color.LIGHT_GRAY);
    074        s.setAxisLabelColor(Color.LIGHT_GRAY);
    075        s.setAxisTickLabelColor(Color.LIGHT_GRAY);
    076        s.setLegendHeaderColor(Color.LIGHT_GRAY);
    077        s.setLegendItemColor(Color.LIGHT_GRAY);
    078        s.setLegendHeaderBackgroundColor(bgcolor);
    079        s.setLegendItemBackgroundColor(bgcolor);
    080        s.setLegendFooterColor(Color.LIGHT_GRAY);
    081        s.setLegendFooterBackgroundColor(bgcolor);
    082        s.setStandardColors(Colors.createBlueOceanColors());
    083        s.setBackgroundPainter(new StandardRectanglePainter(Color.BLACK));
    084        s.setMarkerLabelColor(Color.LIGHT_GRAY);
    085        s.setMarkerLineColor(Color.LIGHT_GRAY);
    086        s.setMarkerFillColor(new Color(100, 100, 255, 32));
    087        return s;
    088    }
    089
    090    /**
    091     * Creates and returns a new instance of the "Pastel" chart style.
    092     *
    093     * @return A chart style (never {@code null}).
    094     */
    095    public static ChartStyle createPastelStyle() {
    096        StandardChartStyle s = new StandardChartStyle();
    097        s.setStandardColors(Colors.createPastelColors());
    098        return s;
    099    }
    100
    101    /**
    102     * Creates and returns a new instance of the "Pastel" chart style.
    103     *
    104     * @return A chart style (never {@code null}).
    105     */
    106    public static ChartStyle createIceCubeStyle() {
    107        StandardChartStyle s = new StandardChartStyle();
    108        s.setStandardColors(Colors.createIceCubeColors());
    109        s.setBackgroundPainter(new StandardRectanglePainter(Color.WHITE));
    110        return s;
    111    }
    112
    113    /**
    114     * Creates and returns a new instance of the "Logical Font" chart style.
    115     * This style uses the Java logical fonts, but is otherwise the same as
    116     * the "Orson 1" chart style.
    117     *
    118     * @return A chart style (never {@code null}).
    119     */
    120    public static ChartStyle createLogicalFontStyle() {
    121        StandardChartStyle s = new StandardChartStyle();
    122        s.setTitleFont(new Font(Font.SANS_SERIF, Font.BOLD, 32));
    123        s.setSubtitleFont(new Font(Font.SERIF, Font.PLAIN, 16));
    124        s.setSectionLabelFont(new Font(Font.SERIF, Font.PLAIN, 16));
    125        s.setAxisLabelFont(new Font(Font.SERIF, Font.BOLD, 16));
    126        s.setAxisTickLabelFont(new Font(Font.SERIF, Font.PLAIN, 14));
    127        s.setLegendHeaderFont(new Font(Font.SERIF, Font.BOLD, 16));
    128        s.setLegendItemFont(new Font(Font.SERIF, Font.PLAIN, 14));
    129        s.setLegendFooterFont(new Font(Font.SERIF, Font.ITALIC, 10));
    130        s.setMarkerLabelFont(new Font(Font.SERIF, Font.PLAIN, 10));
    131        s.setStandardColors(Colors.createFancyLightColors());
    132        return s;
    133    }
    134
    135}