Example usage for java.awt Color magenta

List of usage examples for java.awt Color magenta

Introduction

In this page you can find the example usage for java.awt Color magenta.

Prototype

Color magenta

To view the source code for java.awt Color magenta.

Click Source Link

Document

The color magenta.

Usage

From source file:temp1.RealTimeChart.java

public static JFreeChart createChart(String chartContent, String title, String yaxisName) {
    thread1 = new Thread();
    timeseries1 = new TimeSeries(chartContent, Millisecond.class);
    timeseries2 = new TimeSeries(chartContent, Millisecond.class);
    timeseries3 = new TimeSeries(chartContent, Millisecond.class);
    timeseries4 = new TimeSeries(chartContent, Millisecond.class);

    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries1);
    TimeSeriesCollection timeseriescollection1 = new TimeSeriesCollection(timeseries2);
    TimeSeriesCollection timeseriescollection2 = new TimeSeriesCollection(timeseries3);
    TimeSeriesCollection timeseriescollection3 = new TimeSeriesCollection(timeseries4);

    jfreechart = ChartFactory.createTimeSeriesChart("", "", "", timeseriescollection, false, false, false);

    final XYPlot xyplot = jfreechart.getXYPlot();
    xyplot.setOutlinePaint(Color.magenta);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setRangeGridlinePaint(Color.gray);
    xyplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setAutoRange(true);/*from   ww  w. j  a  va  2s  .  com*/
    valueaxis.setFixedAutoRange(20000D);
    //Value
    valueaxis = xyplot.getRangeAxis();
    valueaxis.setRange(800D, 3300D);
    xyplot.setDataset(0, timeseriescollection);
    xyplot.setDataset(1, timeseriescollection1);
    xyplot.setDataset(2, timeseriescollection2);
    xyplot.setDataset(3, timeseriescollection3);
    XYLineAndShapeRenderer xylineandshaperenderer0 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer2 = new XYLineAndShapeRenderer();
    XYLineAndShapeRenderer xylineandshaperenderer3 = new XYLineAndShapeRenderer();
    xylineandshaperenderer0.setBaseShapesVisible(false);
    xylineandshaperenderer1.setBaseShapesVisible(false);
    xylineandshaperenderer2.setBaseShapesVisible(false);
    xylineandshaperenderer3.setBaseShapesVisible(false);
    xylineandshaperenderer0.setSeriesPaint(0, Color.RED);
    xylineandshaperenderer1.setSeriesPaint(0, Color.cyan);
    xylineandshaperenderer2.setSeriesPaint(0, Color.yellow);
    xylineandshaperenderer3.setSeriesPaint(0, Color.blue);
    xyplot.setRenderer(0, xylineandshaperenderer0);
    xyplot.setRenderer(1, xylineandshaperenderer1);
    xyplot.setRenderer(2, xylineandshaperenderer2);
    xyplot.setRenderer(3, xylineandshaperenderer3);
    //xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(0.5F, 1, 1, 5F, new float[] { 5F, 10F }, 0.0F));
    return jfreechart;
}

From source file:graphml.vertexPainter.java

public Paint transform(node v) //So for each node that we draw...
{
    //We check the member variable, mColor, of the node.
    if (v.getColor().equalsIgnoreCase("yellow")) //If the node's mColor value is "yellow" we...
        return (Color.yellow); // Return our color, Color.yellow.
    else if (v.getColor().equalsIgnoreCase("red"))
        return (Color.red);
    else if (v.getColor().equalsIgnoreCase("blue"))
        return (Color.blue);
    else if (v.getColor().equalsIgnoreCase("green"))
        return (Color.green);
    else//w  ww  . ja v  a 2s .com
        return (Color.MAGENTA);
}

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    Locale.setDefault(Locale.ENGLISH);

    rb.setLocale(Locale.ENGLISH).summary(cht.meterChart().setValue(field("field1", Integer.class))
            .setDataRangeLowExpression(3).setDataRangeHighExpression(30).setValueColor(Color.BLUE)
            .setValueMask("#,###.0").setValueFont(stl.fontArial()).setShape(MeterShape.CIRCLE)
            .setMeterAngle(270).setUnits("units").setTickInterval(3d).setMeterBackgroundColor(Color.LIGHT_GRAY)
            .setNeedleColor(Color.CYAN).setTickColor(Color.MAGENTA).setTickLabelFont(stl.fontCourierNew())
            .intervals(//  ww  w. j  ava 2s .  co  m
                    cht.meterInterval().setLabel("red").setAlpha(0.8).setBackgroundColor(Color.RED)
                            .setDataRangeLowExpression(25).setDataRangeHighExpression(30),
                    cht.meterInterval().setLabel("yellow").setAlpha(0.5).setBackgroundColor(Color.YELLOW)
                            .setDataRangeLowExpression(20).setDataRangeHighExpression(25)),
            cht.meterChart().setValue(5).setShape(MeterShape.DIAL));
}

From source file:org.jfree.chart.demo.CylinderChartDemo1.java

private static Paint[] createPaint() {
    Paint apaint[] = new Paint[5];
    apaint[0] = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.white);
    apaint[1] = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, Color.white);
    apaint[2] = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.white);
    apaint[3] = new GradientPaint(0.0F, 0.0F, Color.orange, 0.0F, 0.0F, Color.white);
    apaint[4] = new GradientPaint(0.0F, 0.0F, Color.magenta, 0.0F, 0.0F, Color.white);
    return apaint;
}

From source file:ShowOff.java

protected void drawBackground(Graphics2D g2) {
    int side = 45;
    int width = getSize().width;
    int height = getSize().height;
    Color[] colors = { Color.yellow, Color.cyan, Color.orange, Color.pink, Color.magenta, Color.lightGray };
    for (int y = 0; y < height; y += side) {
        for (int x = 0; x < width; x += side) {
            Ellipse2D ellipse = new Ellipse2D.Float(x, y, side, side);
            int index = (x + y) / side % colors.length;
            g2.setPaint(colors[index]);//from   w w w .  ja  v a 2s  .com
            g2.fill(ellipse);
        }
    }
}

From source file:com.crunchify.jsp.servlet.BarServlet.java

public JFreeChart getChart() {

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(15, "1", "451");
    dataset.addValue(12, "1", "851");
    dataset.addValue(10, "2", "362");
    dataset.addValue(5, "2", "142");

    JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 3", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            false, // include legend
            true, false);// ww  w.  j av a2  s .  c  o m

    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setNoDataMessage("NO DATA!");

    CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });

    renderer.setItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            45.0);
    renderer.setPositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    // change the margin at the top of the range axis...
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    return chart;

}

From source file:org.deeplearning4j.ui.TestRendering.java

@Ignore
@Test//from w w w  .  j  a  v a 2  s.  com
public void test() throws Exception {

    List<Component> list = new ArrayList<>();

    //Common style for all of the charts
    StyleChart s = new StyleChart.Builder().width(640, LengthUnit.Px).height(480, LengthUnit.Px)
            .margin(LengthUnit.Px, 100, 40, 40, 20).strokeWidth(2).pointSize(4)
            .seriesColors(Color.GREEN, Color.MAGENTA).titleStyle(new StyleText.Builder().font("courier")
                    .fontSize(16).underline(true).color(Color.GRAY).build())
            .build();

    //Line chart with vertical grid
    Component c1 = new ChartLine.Builder("Line Chart!", s)
            .addSeries("series0", new double[] { 0, 1, 2, 3 }, new double[] { 0, 2, 1, 4 })
            .addSeries("series1", new double[] { 0, 1, 2, 3 }, new double[] { 0, 1, 0.5, 2.5 })
            .setGridWidth(1.0, null) //Vertical grid lines, no horizontal grid
            .build();
    list.add(c1);

    //Scatter chart
    Component c2 = new ChartScatter.Builder("Scatter!", s)
            .addSeries("series0", new double[] { 0, 1, 2, 3 }, new double[] { 0, 2, 1, 4 }).showLegend(true)
            .setGridWidth(0, 0).build();
    list.add(c2);

    //Histogram with variable sized bins
    Component c3 = new ChartHistogram.Builder("Histogram!", s).addBin(-1, -0.5, 0.2).addBin(-0.5, 0, 0.5)
            .addBin(0, 1, 2.5).addBin(1, 2, 0.5).build();
    list.add(c3);

    //Stacked area chart
    Component c4 = new ChartStackedArea.Builder("Area Chart!", s).setXValues(new double[] { 0, 1, 2, 3, 4, 5 })
            .addSeries("series0", new double[] { 0, 1, 0, 2, 0, 1 })
            .addSeries("series1", new double[] { 2, 1, 2, 0.5, 2, 1 }).build();
    list.add(c4);

    //Table
    StyleTable ts = new StyleTable.Builder().backgroundColor(Color.LIGHT_GRAY).headerColor(Color.ORANGE)
            .borderWidth(1).columnWidths(LengthUnit.Percent, 20, 40, 40).width(500, LengthUnit.Px)
            .height(200, LengthUnit.Px).build();

    Component c5 = new ComponentTable.Builder(ts).header("H1", "H2", "H3").content(
            new String[][] { { "row0col0", "row0col1", "row0col2" }, { "row1col0", "row1col1", "row1col2" } })
            .build();
    list.add(c5);

    //Accordion decorator, with the same chart
    StyleAccordion ac = new StyleAccordion.Builder().height(480, LengthUnit.Px).width(640, LengthUnit.Px)
            .build();

    Component c6 = new DecoratorAccordion.Builder(ac).title("Accordion - Collapsed By Default!")
            .setDefaultCollapsed(true).addComponents(c5).build();
    list.add(c6);

    //Text with styling
    Component c7 = new ComponentText.Builder("Here's some blue text in a green div!",
            new StyleText.Builder().font("courier").fontSize(30).underline(true).color(Color.BLUE).build())
                    .build();

    //Div, with a chart inside
    Style divStyle = new StyleDiv.Builder().width(30, LengthUnit.Percent).height(200, LengthUnit.Px)
            .backgroundColor(Color.GREEN).floatValue(StyleDiv.FloatValue.right).build();
    Component c8 = new ComponentDiv(divStyle, c7,
            new ComponentText("(Also: it's float right, 30% width, 200 px high )", null));
    list.add(c8);

    //Timeline chart:
    List<ChartTimeline.TimelineEntry> entries = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        entries.add(new ChartTimeline.TimelineEntry("e0-" + i, 10 * i, 10 * i + 5, Color.BLUE));
    }
    List<ChartTimeline.TimelineEntry> entries2 = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        entries2.add(new ChartTimeline.TimelineEntry("e1-" + i, (int) (5 * i + 0.2 * i * i),
                (int) (5 * i + 0.2 * i * i) + 3, Color.ORANGE));
    }
    List<ChartTimeline.TimelineEntry> entries3 = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        entries3.add(new ChartTimeline.TimelineEntry("e2-" + i, (int) (2 * i + 0.6 * i * i + 3),
                (int) (2 * i + 0.6 * i * i + 3) + 2 * i + 1));
    }
    Color[] c = new Color[] { Color.CYAN, Color.YELLOW, Color.GREEN, Color.PINK };
    List<ChartTimeline.TimelineEntry> entries4 = new ArrayList<>();
    Random r = new Random(12345);
    for (int i = 0; i < 10; i++) {
        entries4.add(new ChartTimeline.TimelineEntry("e3-" + i, (int) (2 * i + 0.6 * i * i + 3),
                (int) (2 * i + 0.6 * i * i + 3) + i + 1, c[r.nextInt(c.length)]));
    }
    Component c9 = new ChartTimeline.Builder("Title", s).addLane("Lane 0", entries).addLane("Lane 1", entries2)
            .addLane("Lane 2", entries3).addLane("Lane 3", entries4).build();
    list.add(c9);

    //Generate HTML
    StringBuilder sb = new StringBuilder();
    sb.append("<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + "<head>\n" + "    <meta charset=\"UTF-8\">\n"
            + "    <title>Title</title>\n" + "</head>\n" + "<body>\n" + "\n" + "    <div id=\"maindiv\">\n"
            + "\n" + "    </div>\n" + "\n" + "\n"
            + "    <script src=\"//code.jquery.com/jquery-1.10.2.js\"></script>\n"
            + "    <script src=\"https://code.jquery.com/ui/1.11.4/jquery-ui.min.js\"></script>\n"
            + "    <link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css\">\n"
            + "    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js\"></script>\n"
            + "    <script src=\"src/main/resources/assets/dl4j-ui.js\"></script>\n" + "\n" + "    <script>\n");

    ObjectMapper om = new ObjectMapper();
    for (int i = 0; i < list.size(); i++) {
        Component component = list.get(i);
        sb.append("        ").append("var str").append(i).append(" = '")
                .append(om.writeValueAsString(component).replaceAll("'", "\\\\'")).append("';\n");

        sb.append("        ").append("var obj").append(i).append(" = Component.getComponent(str").append(i)
                .append(");\n");
        sb.append("        ").append("obj").append(i).append(".render($('#maindiv'));\n");
        sb.append("\n\n");
    }

    sb.append("    </script>\n" + "\n" + "</body>\n" + "</html>");

    FileUtils.writeStringToFile(new File("TestRendering.html"), sb.toString());
}

From source file:statistic.graph.JChartPanel.java

protected static JFreeChart createChart() {
    stepDataset = new XYSeriesCollection();
    linearDataset = new XYSeriesCollection();

    chart = ChartFactory.createXYLineChart("Fluss", "Zeiteinheiten", "Flusseinheiten", stepDataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.WHITE);

    plot = (XYPlot) chart.getPlot();//from w  w  w. j a v  a 2  s .co m
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    plot.setDataset(0, stepDataset);
    plot.setDataset(1, linearDataset);

    XYItemRenderer r = plot.getRenderer();
    //r.setBaseOutlinePaint(Color.BLACK);
    //r.setBasePaint();
    //r.setItemLabelPaint();
    //r.setOutlinePaint(Color.BLACK);
    //r.setSeriesItemLabelPaint();
    //r.setSeriesOutlinePaint();
    r.setSeriesPaint(0, Color.GREEN.darker());
    r.setSeriesPaint(1, Color.MAGENTA.darker());
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }
    //XYStepRenderer r3 = new XYStepRenderer();
    //r.setBaseOutlinePaint(Color.BLACK);
    //r.setBasePaint();
    //r.setItemLabelPaint();
    //r.setOutlinePaint(Color.BLACK);
    //r.setSeriesItemLabelPaint();
    //r.setSeriesOutlinePaint();
    //r3.setSeriesPaint(0, Color.BLACK);
    //r3.setShapesVisible(true);
    //r3.setShapesFilled(true);
    //r3.setSeriesShapesFilled(0,true);
    //r3.set
    //r3.setSeriesStroke(0, new BasicStroke(2.0f));

    XYItemRenderer r2 = new XYStepRenderer();
    r2.setSeriesPaint(2, Color.BLACK);
    plot.setRenderer(r2);
    plot.setRenderer(1, r);
    //plot.setRenderer(2, r3);

    plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getDomainAxis().setRange(-0.5, 10);

    plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.getRangeAxis().setRange(-0.5, 8.5);

    return chart;
}

From source file:com.testautomationguru.utility.PDFUtil.java

public PDFUtil() {
    this.bTrimWhiteSpace = true;
    this.bHighlightPdfDifference = false;
    this.imgColor = Color.MAGENTA;
    this.bCompareAllPages = false;
    this.compareMode = CompareMode.TEXT_MODE;
    logger.setLevel(Level.OFF);/*from w w w  .ja  va 2  s . c o  m*/
    System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
}

From source file:net.sf.dynamicreports.test.jasper.chart.ChartSeriesColorsByNameTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<String> column2;
    TextColumnBuilder<Integer> column3;
    TextColumnBuilder<String> column4;
    TextColumnBuilder<Integer> column5;

    colors = new HashMap<String, Color>();
    colors.put("a", Color.BLUE);
    colors.put("b", Color.YELLOW);
    colors.put("c", Color.GREEN);
    colors.put("d", Color.MAGENTA);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", String.class),
            column3 = col.column("Column3", "field3", Integer.class),
            column4 = col.column("Column4", "field4", String.class),
            column5 = col.column("Column5", "field5", Integer.class))
            .summary(/*w w  w  . jav a  2s. c  om*/
                    cmp.horizontalList(
                            cht.barChart().seriesColorsByName(colors).setCategory(column1)
                                    .series(cht.serie(column3).setSeries(column2)),
                            cht.groupedStackedBarChart().seriesColorsByName(colors).setCategory(column1)
                                    .series(cht.groupedSerie(column3).setSeries(column2).setGroup(column4))),
                    cmp.horizontalList(
                            cht.pieChart().seriesColorsByName(colors).setKey(column2).series(cht
                                    .serie(column3)),
                            cht.xyBarChart().seriesColorsByName(colors).setXValue(column5)
                                    .series(cht.xySerie(column3).setSeries(column2))),
                    cmp.horizontalList(
                            cht.barChart()
                                    .setDataSource(
                                            new DRDataSource("field1", "field2", "field3", "field4", "field5"))
                                    .seriesColorsByName(colors).setCategory(column1)
                                    .series(cht.serie(column3).setSeries(column2)),
                            cht.pieChart()
                                    .setDataSource(
                                            new DRDataSource("field1", "field2", "field3", "field4", "field5"))
                                    .seriesColorsByName(colors).setKey(column2).series(cht.serie(column3)),
                            cht.xyBarChart()
                                    .setDataSource(
                                            new DRDataSource("field1", "field2", "field3", "field4", "field5"))
                                    .seriesColorsByName(colors).setXValue(column5)
                                    .series(cht.xySerie(column3).setSeries(column2))));
}