Search in sources :

Example 6 with DefaultDrawingSupplier

use of org.jfree.chart.plot.DefaultDrawingSupplier in project mzmine2 by mzmine.

the class GraphicsExportDialog method setStandardColors.

/**
 * Sets the colours of the selected colour palette to the chart theme.
 */
protected void setStandardColors() {
    DrawingSupplier ds = new DefaultDrawingSupplier(colors, colors, colors, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    theme.setDrawingSupplier(ds);
}
Also used : DrawingSupplier(org.jfree.chart.plot.DrawingSupplier) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier)

Example 7 with DefaultDrawingSupplier

use of org.jfree.chart.plot.DefaultDrawingSupplier in project mzmine2 by mzmine.

the class ChartThemeFactory method createKarstTheme.

/**
 * Creates the theme called "Karst". In this theme, the charts have a blue background and yellow
 * lines and labels.
 *
 * @return The "Karst" theme.
 */
public static EStandardChartTheme createKarstTheme() {
    EStandardChartTheme theme = new EStandardChartTheme(THEME.KARST, "Karst");
    // Fonts
    theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 20));
    theme.setLargeFont(new Font("Arial", Font.BOLD, 11));
    theme.setRegularFont(new Font("Arial", Font.PLAIN, 11));
    theme.setSmallFont(new Font("Arial", Font.PLAIN, 11));
    // 
    Paint bg = new Color(50, 50, 202);
    // 
    theme.setTitlePaint(Color.green);
    theme.setSubtitlePaint(Color.yellow);
    theme.setLegendBackgroundPaint(bg);
    theme.setLegendItemPaint(Color.yellow);
    theme.setChartBackgroundPaint(bg);
    theme.setPlotBackgroundPaint(bg);
    theme.setPlotOutlinePaint(Color.yellow);
    theme.setBaselinePaint(Color.white);
    theme.setCrosshairPaint(Color.red);
    theme.setLabelLinkPaint(Color.lightGray);
    theme.setTickLabelPaint(Color.yellow);
    theme.setAxisLabelPaint(Color.yellow);
    theme.setShadowPaint(Color.darkGray);
    theme.setItemLabelPaint(Color.yellow);
    theme.setDrawingSupplier(new DefaultDrawingSupplier(new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587") }, new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC") }, new Stroke[] { new BasicStroke(2.0f) }, new Stroke[] { new BasicStroke(0.5f) }, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    theme.setErrorIndicatorPaint(Color.lightGray);
    theme.setGridBandPaint(new Color(255, 255, 255, 20));
    theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40));
    // axis
    Color transp = new Color(255, 255, 255, 200);
    theme.setRangeGridlinePaint(transp);
    theme.setDomainGridlinePaint(transp);
    theme.setAxisLinePaint(Color.yellow);
    theme.setMasterFontColor(Color.yellow);
    // axis offset
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    return theme;
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Color(java.awt.Color) ChartColor(org.jfree.chart.ChartColor) RectangleInsets(org.jfree.chart.ui.RectangleInsets) Paint(java.awt.Paint) Font(java.awt.Font) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier)

Example 8 with DefaultDrawingSupplier

use of org.jfree.chart.plot.DefaultDrawingSupplier in project xwiki-platform by xwiki.

the class DrawingSupplierFactory method createDrawingSupplier.

/**
 * @param parameters the user-defined parameters, containing {@link #COLORS_PARAM} if the user wants custom colors
 * @return the Drawing Supplier to use
 */
public DrawingSupplier createDrawingSupplier(Map<String, String> parameters) {
    DrawingSupplier supplier;
    String colorParam = parameters.get(COLORS_PARAM);
    if (colorParam != null) {
        List<Color> colors = new ArrayList<Color>();
        for (String colorAsString : colorParam.split(",")) {
            if (colorAsString.length() == 6) {
                int red = Integer.parseInt(colorAsString.substring(0, 2), 16);
                int green = Integer.parseInt(colorAsString.substring(2, 4), 16);
                int blue = Integer.parseInt(colorAsString.substring(4, 6), 16);
                colors.add(new Color(red, green, blue));
            }
        }
        Paint[] paint = new Paint[colors.size()];
        int i = 0;
        for (Color color : colors) {
            paint[i++] = color;
        }
        supplier = new DefaultDrawingSupplier(paint, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);
    } else {
        supplier = new DefaultDrawingSupplier();
    }
    return supplier;
}
Also used : Color(java.awt.Color) ArrayList(java.util.ArrayList) DrawingSupplier(org.jfree.chart.plot.DrawingSupplier) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier) Paint(java.awt.Paint) Paint(java.awt.Paint) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier)

Example 9 with DefaultDrawingSupplier

use of org.jfree.chart.plot.DefaultDrawingSupplier in project mzmine2 by mzmine.

the class ChartThemeFactory method createDarknessTheme.

/**
 * Creates and returns a theme called "Darkness". In this theme, the charts have a black
 * background and white lines and labels
 *
 * @return The "Darkness" theme.
 */
public static EStandardChartTheme createDarknessTheme() {
    EStandardChartTheme theme = new EStandardChartTheme(THEME.DARKNESS, "Darkness");
    // Fonts
    theme.setExtraLargeFont(new Font("Arial", Font.BOLD, 20));
    theme.setLargeFont(new Font("Arial", Font.BOLD, 11));
    theme.setRegularFont(new Font("Arial", Font.PLAIN, 11));
    theme.setSmallFont(new Font("Arial", Font.PLAIN, 11));
    // 
    theme.setTitlePaint(Color.white);
    theme.setSubtitlePaint(Color.white);
    theme.setLegendBackgroundPaint(Color.black);
    theme.setLegendItemPaint(Color.white);
    theme.setChartBackgroundPaint(Color.black);
    theme.setPlotBackgroundPaint(Color.black);
    theme.setPlotOutlinePaint(Color.yellow);
    theme.setBaselinePaint(Color.white);
    theme.setCrosshairPaint(Color.red);
    theme.setLabelLinkPaint(Color.lightGray);
    theme.setTickLabelPaint(Color.white);
    theme.setAxisLabelPaint(Color.white);
    theme.setShadowPaint(Color.darkGray);
    theme.setItemLabelPaint(Color.white);
    theme.setDrawingSupplier(new DefaultDrawingSupplier(new Paint[] { Color.WHITE, Color.decode("0xFFFF00"), Color.decode("0x0036CC"), Color.decode("0xFF0000"), Color.decode("0xFFFF7F"), Color.decode("0x6681CC"), Color.decode("0xFF7F7F"), Color.decode("0xFFFFBF"), Color.decode("0x99A6CC"), Color.decode("0xFFBFBF"), Color.decode("0xA9A938"), Color.decode("0x2D4587") }, new Paint[] { Color.decode("0xFFFF00"), Color.decode("0x0036CC") }, new Stroke[] { new BasicStroke(2.0f) }, new Stroke[] { new BasicStroke(0.5f) }, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    theme.setErrorIndicatorPaint(Color.lightGray);
    theme.setGridBandPaint(new Color(255, 255, 255, 20));
    theme.setGridBandAlternatePaint(new Color(255, 255, 255, 40));
    // axis
    Color transp = new Color(255, 255, 255, 200);
    theme.setRangeGridlinePaint(transp);
    theme.setDomainGridlinePaint(transp);
    theme.setAxisLinePaint(Color.white);
    theme.setMasterFontColor(Color.WHITE);
    // axis offset
    theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
    return theme;
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) Color(java.awt.Color) ChartColor(org.jfree.chart.ChartColor) RectangleInsets(org.jfree.chart.ui.RectangleInsets) Paint(java.awt.Paint) Font(java.awt.Font) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier)

Example 10 with DefaultDrawingSupplier

use of org.jfree.chart.plot.DefaultDrawingSupplier in project mzmine2 by mzmine.

the class EIsotopePatternChartTheme method initialize.

public void initialize() {
    // Fonts
    this.setExtraLargeFont(new Font("Arial", Font.BOLD, 16));
    this.setLargeFont(new Font("Arial", Font.BOLD, 11));
    this.setRegularFont(new Font("Arial", Font.PLAIN, 11));
    this.setSmallFont(new Font("Arial", Font.PLAIN, 11));
    // paints
    this.setTitlePaint(Color.black);
    this.setSubtitlePaint(Color.black);
    this.setLegendItemPaint(Color.black);
    this.setPlotOutlinePaint(Color.black);
    this.setBaselinePaint(Color.black);
    this.setCrosshairPaint(Color.black);
    this.setLabelLinkPaint(Color.black);
    this.setTickLabelPaint(Color.black);
    this.setAxisLabelPaint(Color.black);
    this.setShadowPaint(Color.black);
    this.setItemLabelPaint(Color.black);
    this.setLegendBackgroundPaint(Color.white);
    this.setChartBackgroundPaint(Color.white);
    this.setPlotBackgroundPaint(Color.white);
    Paint[] colors = new Paint[] { Color.BLACK, new Color(0xFF, 0x55, 0x55), new Color(0x55, 0x55, 0xFF), new Color(0x55, 0xFF, 0x55), new Color(0xFF, 0xFF, 0x55), new Color(0xFF, 0x55, 0xFF), new Color(0x55, 0xFF, 0xFF), Color.pink, Color.gray, ChartColor.DARK_RED, ChartColor.DARK_BLUE, ChartColor.DARK_GREEN, ChartColor.DARK_YELLOW, ChartColor.DARK_MAGENTA, ChartColor.DARK_CYAN, Color.darkGray, ChartColor.LIGHT_RED, ChartColor.LIGHT_BLUE, ChartColor.LIGHT_GREEN, ChartColor.LIGHT_YELLOW, ChartColor.LIGHT_MAGENTA, ChartColor.LIGHT_CYAN, Color.lightGray, ChartColor.VERY_DARK_RED, ChartColor.VERY_DARK_BLUE, ChartColor.VERY_DARK_GREEN, ChartColor.VERY_DARK_YELLOW, ChartColor.VERY_DARK_MAGENTA, ChartColor.VERY_DARK_CYAN, ChartColor.VERY_LIGHT_RED, ChartColor.VERY_LIGHT_BLUE, ChartColor.VERY_LIGHT_GREEN, ChartColor.VERY_LIGHT_YELLOW, ChartColor.VERY_LIGHT_MAGENTA, ChartColor.VERY_LIGHT_CYAN };
    this.setDrawingSupplier(new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
    this.setRangeGridlinePaint(Color.GRAY);
    this.setDomainGridlinePaint(Color.GRAY);
    this.setAxisLinePaint(Color.black);
}
Also used : Color(java.awt.Color) ChartColor(org.jfree.chart.ChartColor) Paint(java.awt.Paint) Font(java.awt.Font) DefaultDrawingSupplier(org.jfree.chart.plot.DefaultDrawingSupplier)

Aggregations

DefaultDrawingSupplier (org.jfree.chart.plot.DefaultDrawingSupplier)15 Paint (java.awt.Paint)13 Color (java.awt.Color)9 BasicStroke (java.awt.BasicStroke)8 Stroke (java.awt.Stroke)8 Font (java.awt.Font)6 ChartColor (org.jfree.chart.ChartColor)4 RectangleInsets (org.jfree.chart.ui.RectangleInsets)3 GradientPaint (java.awt.GradientPaint)2 Shape (java.awt.Shape)2 DrawingSupplier (org.jfree.chart.plot.DrawingSupplier)2 StandardBarPainter (org.jfree.chart.renderer.category.StandardBarPainter)2 StandardXYBarPainter (org.jfree.chart.renderer.xy.StandardXYBarPainter)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 RectangleInsets (org.jfree.chart.api.RectangleInsets)1 CategoryAxis (org.jfree.chart.axis.CategoryAxis)1 DateAxis (org.jfree.chart.axis.DateAxis)1 NumberAxis (org.jfree.chart.axis.NumberAxis)1