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:com.mentor.questa.ucdb.jenkins.QuestaCoverageAction.java

private JFreeChart createBarChart(final StaplerRequest req, final CategoryDataset dataset, final String title) {
    JFreeChart chart = ChartFactory.createBarChart(title, //title
            null, //categoryaxislabel, 
            null, //valueaxislabel    
            dataset, //dataset
            PlotOrientation.HORIZONTAL, //orientation
            false, //legend
            true, //tooltips
            false //urls
    );//  ww w . jav a  2  s.c  om

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);

    final BarRenderer cir = new BarRenderer() {
        private final Paint[] colors = { Color.red, Color.blue, Color.green, Color.yellow, Color.orange,
                Color.cyan, Color.magenta, Color.blue };

        /**
         * Returns the paint for an item. Overrides the default behavior
         * inherited from AbstractSeriesRenderer.
         *
         * @param row the series.
         * @param column the category.
         *
         * @return The item color.
         */
        @Override
        public Paint getItemPaint(final int row, final int column) {
            return colors[column % colors.length];
        }
    };
    cir.setMaximumBarWidth(0.35);
    plot.setRenderer(cir);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:org.micromanager.asidispim.Utils.PlotUtils.java

/**
 * Create a frame with a plot of the data given in XYSeries overwrite any
 * previously created frame with the same title
 *
        /*from  w  w w . j  a  v a  2s. co  m*/
 * @param title shown in the top of the plot
 * @param data array with data series to be plotted
 * @param xTitle Title of the X axis
 * @param yTitle Title of the Y axis
 * @param showShapes whether or not to draw shapes at the data points
 * @param annotation to be shown in plot
 * @return Frame that displays the data
 */
public Frame plotDataN(String title, XYSeries[] data, String xTitle, String yTitle, boolean[] showShapes,
        String annotation) {

    // if we already have a plot open with this title, close it, but remember
    // its position
    Frame[] gfs = ChartFrame.getFrames();
    for (Frame f : gfs) {
        if (f.getTitle().equals(title)) {
            f.dispose();
        }
    }

    // JFreeChart code
    XYSeriesCollection dataset = new XYSeriesCollection();
    // calculate min and max to scale the graph
    double minX, minY, maxX, maxY;
    minX = data[0].getMinX();
    minY = data[0].getMinY();
    maxX = data[0].getMaxX();
    maxY = data[0].getMaxY();
    for (XYSeries d : data) {
        dataset.addSeries(d);
        if (d.getMinX() < minX) {
            minX = d.getMinX();
        }
        if (d.getMaxX() > maxX) {
            maxX = d.getMaxX();
        }
        if (d.getMinY() < minY) {
            minY = d.getMinY();
        }
        if (d.getMaxY() > maxY) {
            maxY = d.getMaxY();
        }
    }

    JFreeChart chart = ChartFactory.createScatterPlot(title, // Title
            xTitle, // x-axis Label
            yTitle, // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            false, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);

    for (int i = 0; i < data.length; i++) {
        renderer.setSeriesFillPaint(i, Color.white);
        renderer.setSeriesLinesVisible(i, true);
    }

    renderer.setSeriesPaint(0, Color.blue);
    Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
    renderer.setSeriesShape(0, circle, false);

    if (data.length > 1) {
        renderer.setSeriesPaint(1, Color.red);
        Shape square = new Rectangle2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
        renderer.setSeriesShape(1, square, false);
    }
    if (data.length > 2) {
        renderer.setSeriesPaint(2, Color.darkGray);
        Shape rect = new Rectangle2D.Float(-2.0f, -1.0f, 4.0f, 2.0f);
        renderer.setSeriesShape(2, rect, false);
    }
    if (data.length > 3) {
        renderer.setSeriesPaint(3, Color.magenta);
        Shape rect = new Rectangle2D.Float(-1.0f, -2.0f, 2.0f, 4.0f);
        renderer.setSeriesShape(3, rect, false);
    }

    for (int i = 0; i < data.length; i++) {
        if (showShapes.length > i && !showShapes[i]) {
            renderer.setSeriesShapesVisible(i, false);
        }
    }

    XYAnnotation an = new XYTextAnnotation(annotation, maxX - 0.01, maxY);
    plot.addAnnotation(an);

    renderer.setUseFillPaint(true);

    final MyChartFrame graphFrame = new MyChartFrame(title, chart);
    graphFrame.getChartPanel().setMouseWheelEnabled(true);
    graphFrame.pack();
    graphFrame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent arg0) {
            graphFrame.dispose();
        }
    });

    graphFrame.setVisible(true);

    return graphFrame;
}

From source file:umontreal.ssj.charts.SSJCategorySeriesCollection.java

/**
 * Gives the default color associated with a series
 *
 * @param   index Index of the series in the CategoryDataset object.
 * @return        default color object./*from   w ww .j  a  v  a  2  s .  c om*/
 */
protected static Color getDefaultColor(int index) {
    if (index % 6 == 0)
        return Color.RED;
    else if (index % 6 == 1)
        return Color.BLUE;
    else if (index % 6 == 2)
        return Color.GREEN;
    else if (index % 6 == 3)
        return Color.YELLOW;
    else if (index % 6 == 4)
        return Color.MAGENTA;
    else
        return Color.CYAN;
}

From source file:com.jolbox.benchmark.BenchmarkLaunch.java

/**
 * @param results/*from  w  w  w .j a v  a  2s . c  o m*/
 * @param delay 
 * @param statementBenchmark 
 * @param noC3P0 
 * @throws IOException 
 */
private static void doPlotLineGraph(long[][] results, int delay, boolean statementBenchmark, boolean noC3P0)
        throws IOException {
    String title = "Multi-Thread test (" + delay + "ms delay)";
    if (statementBenchmark) {
        title += "\n(with PreparedStatements tests)";
    }
    String fname = System.getProperty("java.io.tmpdir") + File.separator + "bonecp-multithread-" + delay
            + "ms-delay";
    if (statementBenchmark) {
        fname += "-with-preparedstatements";
    }
    fname += "-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads;
    if (noC3P0) {
        fname += "-noC3P0";
    }
    PrintWriter out = new PrintWriter(new FileWriter(fname + ".txt"));
    fname += ".png";

    XYSeriesCollection dataset = new XYSeriesCollection();
    for (int i = 0; i < ConnectionPoolType.values().length; i++) { //
        if (!ConnectionPoolType.values()[i].isEnabled()
                || (noC3P0 && ConnectionPoolType.values()[i].equals(ConnectionPoolType.C3P0))) {
            continue;
        }
        XYSeries series = new XYSeries(ConnectionPoolType.values()[i].toString());
        out.println(ConnectionPoolType.values()[i].toString());
        for (int j = 1 + BenchmarkTests.stepping; j < results[i].length; j += BenchmarkTests.stepping) {
            series.add(j, results[i][j]);
            out.println(j + "," + results[i][j]);
        }
        dataset.addSeries(series);
    }
    out.close();

    //         Generate the graph
    JFreeChart chart = ChartFactory.createXYLineChart(title, // Title
            "threads", // x-axis Label
            "time (ns)", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );

    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.YELLOW);
    renderer.setSeriesPaint(2, Color.BLACK);
    renderer.setSeriesPaint(3, Color.DARK_GRAY);
    renderer.setSeriesPaint(4, Color.MAGENTA);
    renderer.setSeriesPaint(5, Color.RED);
    renderer.setSeriesPaint(6, Color.LIGHT_GRAY);
    //          renderer.setSeriesShapesVisible(1, true);   
    //          renderer.setSeriesShapesVisible(2, true);   

    try {
        ChartUtilities.saveChartAsPNG(new File(fname), chart, 1024, 768);
        System.out.println("******* Saved chart to: " + fname);
    } catch (IOException e) {
        System.err.println("Problem occurred creating chart.");
    }

}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

private JFreeChart createChart(XYDataset dataset, String title, String xTitle, String yTitle) {

    colors.add(Color.BLACK);//from w w  w . ja  va  2s.co m
    colors.add(1, Color.BLUE);
    colors.add(1, Color.RED);
    colors.add(1, Color.GREEN);
    colors.add(1, Color.YELLOW);
    colors.add(1, Color.CYAN);
    colors.add(1, Color.MAGENTA);
    colors.add(1, new Color(111, 83, 64));
    colors.add(1, new Color(153, 51, 255));
    colors.add(1, new Color(102, 204, 255));
    colors.add(1, new Color(85, 80, 126));
    colors.add(1, new Color(168, 80, 126));

    chart = ChartFactory.createXYLineChart(title, xTitle, yTitle, dataset, PlotOrientation.VERTICAL, true, true,
            false);

    chart.setBackgroundPaint(Color.white);

    chart.getXYPlot().setBackgroundPaint(Color.white);
    chart.getXYPlot().setDomainGridlinePaint(Color.white);
    chart.getXYPlot().setRangeGridlinePaint(Color.white);

    int numSeries = series.getSeriesCount();

    XYLineAndShapeRenderer renderer = ((XYLineAndShapeRenderer) chart.getXYPlot().getRenderer());

    renderer.setDrawSeriesLineAsPath(true);

    renderer.setSeriesStroke(0, new BasicStroke(2.0F));

    renderer.setSeriesStroke(1,
            new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2 }, 0));

    renderer.setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(3, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(4, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(5, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 12, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, 0));

    renderer.setSeriesStroke(6, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    renderer.setSeriesStroke(7, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f,
            new float[] { 6.0f, 2.0f, 6.0f, 2.0f, 6.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.0f }, 0.0f));

    for (int i = 0; i < numSeries; i++) {

        if (i == colors.size()) {

            colors = addColors(colors, numSeries);

        }

        if (viewWithOutColor) {
            renderer.setSeriesPaint(i, Color.BLACK);
        } else {
            String name = series.getSeries(i).getKey().toString();

            if (!controlCurveColor.containsKey(name)) {
                renderer.setSeriesPaint(i, colors.get(i));
                controlCurveColor.put(name, colors.get(i));

            } else {

                renderer.setSeriesPaint(i, controlCurveColor.get(name));

            }

            renderer.setSeriesShapesVisible(i, viewPointsForm);

            if (viewWhiteBackground) {
                chart.getXYPlot().setBackgroundPaint(Color.WHITE);
            }
        }
    }
    chart.getXYPlot().setRenderer(renderer);

    return chart;
}

From source file:com.att.aro.ui.view.diagnostictab.plot.BufferInSecondsPlot.java

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis != null) {
        VideoUsage videoUsage = analysis.getAnalyzerResult().getVideoUsage();
        bufferFillDataCollection.removeAllSeries();
        seriesBufferFill = new XYSeries("Buffer Against Play Time");
        seriesDataSets = new TreeMap<>();

        seriesDataSets = bufferInSecondsCalculatorImpl.populate(videoUsage, chunkPlayTimeList);
        //updating video stall result in packetAnalyzerResult
        analysis.getAnalyzerResult().setVideoStalls(bufferInSecondsCalculatorImpl.getVideoStallResult());

        bufferTimeList.clear();//  ww w  .  j  a v  a 2  s.  c  o  m
        double xCoordinate, yCoordinate;
        String ptCoordinate[] = new String[2]; // to hold x & y values
        if (!seriesDataSets.isEmpty()) {

            for (int key : seriesDataSets.keySet()) {
                ptCoordinate = seriesDataSets.get(key).trim().split(",");
                xCoordinate = Double.parseDouble(ptCoordinate[0]);
                yCoordinate = Double.parseDouble(ptCoordinate[1]);
                bufferTimeList.add(yCoordinate);

                seriesBufferFill.add(xCoordinate, yCoordinate);
            }
        }

        Collections.sort(bufferTimeList);
        BufferTimeBPResult bufferTimeResult = bufferInSecondsCalculatorImpl
                .updateBufferTimeResult(bufferTimeList);
        analysis.getAnalyzerResult().setBufferTimeResult(bufferTimeResult);
        // populate collection
        bufferFillDataCollection.addSeries(seriesBufferFill);

        XYItemRenderer renderer = new StandardXYItemRenderer();
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {

                // Tooltip value
                Number timestamp = dataset.getX(series, item);
                Number bufferTime = dataset.getY(series, item);
                StringBuffer tooltipValue = new StringBuffer();

                Map<Double, Long> segmentEndTimeMap = bufferInSecondsCalculatorImpl.getSegmentEndTimeMap();
                Map<Long, Double> segmentStartTimeMap = bufferInSecondsCalculatorImpl.getSegmentStartTimeMap();
                double firstSegmentNo = videoUsage.getChunksBySegmentNumber().get(0).getSegment();

                DecimalFormat decimalFormat = new DecimalFormat("0.##");
                if (segmentStartTimeMap == null || segmentStartTimeMap.isEmpty()) {
                    return "-,-,-";
                }

                List<Long> segmentList = new ArrayList<Long>(segmentEndTimeMap.values());
                Collections.sort(segmentList);
                Long lastSegmentNo = segmentList.get(segmentList.size() - 1);

                Long segmentNumber = 0L;
                boolean isSegmentPlaying = false;
                boolean startup = false;
                boolean endPlay = false;

                for (double segmentEndTime : segmentEndTimeMap.keySet()) {
                    if (segmentEndTime > timestamp.doubleValue()) {
                        segmentNumber = segmentEndTimeMap.get(segmentEndTime);
                        if (segmentNumber == firstSegmentNo) {
                            startup = true;
                        }
                        if (segmentStartTimeMap.get(segmentNumber) <= timestamp.doubleValue()) {
                            tooltipValue.append(decimalFormat.format(segmentNumber) + ",");
                            isSegmentPlaying = true;
                            startup = false;
                        }
                    } else if (lastSegmentNo.equals(segmentEndTimeMap.get(segmentEndTime))
                            && segmentEndTime == timestamp.doubleValue()) {
                        endPlay = true;
                    }
                }

                if (endPlay || startup) {
                    tooltipValue.append("-,");
                } else if (!isSegmentPlaying && !startup) {
                    tooltipValue.append("Stall,");
                }

                tooltipValue.append(String.format("%.2f", bufferTime) + "," + String.format("%.2f", timestamp));

                String[] value = tooltipValue.toString().split(",");
                return (MessageFormat.format(BUFFER_TIME_OCCUPANCY_TOOLTIP, value[0], value[1], value[2]));
            }

        });
        renderer.setSeriesStroke(0, new BasicStroke(2.0f));
        renderer.setSeriesPaint(0, Color.MAGENTA);

        renderer.setSeriesShape(0, shape);

        plot.setRenderer(renderer);

    }
    plot.setDataset(bufferFillDataCollection);
}

From source file:umontreal.iro.lecuyer.charts.SSJCategorySeriesCollection.java

protected static Color getDefaultColor(int index) {
    if (index % 6 == 0)
        return Color.RED;
    else if (index % 6 == 1)
        return Color.BLUE;
    else if (index % 6 == 2)
        return Color.GREEN;
    else if (index % 6 == 3)
        return Color.YELLOW;
    else if (index % 6 == 4)
        return Color.MAGENTA;
    else//from   w  w w .ja v a2s . c  o  m
        return Color.CYAN;
}

From source file:uk.ac.ncl.aries.entanglement.cli.export.MongoGraphToGDF.java

private static Map<String, Color> loadColorMappings(File propFile) throws IOException {
    FileInputStream is = new FileInputStream(propFile);
    Properties props = new Properties();
    props.load(is);//from   w ww. j  a v a  2 s.c o m
    is.close();

    Map<String, Color> nodeTypeToColour = new HashMap<>();
    for (String nodeType : props.stringPropertyNames()) {
        String colorString = props.getProperty(nodeType);
        Color color;

        switch (colorString) {
        case "BLACK":
            color = Color.BLACK;
            break;
        case "BLUE":
            color = Color.BLUE;
            break;
        case "CYAN":
            color = Color.CYAN;
            break;
        case "DARK_GRAY":
            color = Color.DARK_GRAY;
            break;
        case "GRAY":
            color = Color.GRAY;
            break;
        case "GREEN":
            color = Color.GREEN;
            break;
        case "LIGHT_GRAY":
            color = Color.LIGHT_GRAY;
            break;
        case "MAGENTA":
            color = Color.MAGENTA;
            break;
        case "ORANGE":
            color = Color.ORANGE;
            break;
        case "PINK":
            color = Color.PINK;
            break;
        case "RED":
            color = Color.RED;
            break;
        case "WHITE":
            color = Color.WHITE;
            break;
        case "YELLOW":
            color = Color.YELLOW;
            break;
        default:
            color = DEFAULT_COLOR;
        }

        nodeTypeToColour.put(nodeType, color);
    }
    return nodeTypeToColour;
}

From source file:org.esa.nest.gpf.ForestAreaDetectionOp.java

/**
 * Add the user selected bands to target product.
 *
 * @throws OperatorException The exceptions.
 *///www. ja va 2s. c om
private void addSelectedBands() throws OperatorException {

    sourceBandNames[0] = nominatorBandName;
    sourceBandNames[1] = denominatorBandName;
    for (String bandName : sourceBandNames) {
        final String bandUnit = sourceProduct.getBand(bandName).getUnit();

        if (!bandUnit.equals(Unit.AMPLITUDE) && !bandUnit.equals(Unit.INTENSITY)
                && !bandUnit.equals(Unit.AMPLITUDE_DB) && !bandUnit.equals(Unit.INTENSITY_DB)) {
            throw new OperatorException("Please select amplitude or intensity band");
        }

        ProductUtils.copyBand(bandName, sourceProduct, bandName, targetProduct, true);
    }

    final Band targetRatioBand = new Band(RATIO_BAND_NAME, ProductData.TYPE_FLOAT32, sourceImageWidth,
            sourceImageHeight);

    targetRatioBand.setNoDataValue(0);
    targetRatioBand.setNoDataValueUsed(true);
    targetRatioBand.setUnit("ratio");
    targetProduct.addBand(targetRatioBand);

    final String expression = RATIO_BAND_NAME + " > " + String.valueOf(T_Ratio_Low) + " && " + RATIO_BAND_NAME
            + " < " + String.valueOf(T_Ratio_High);

    final Mask mask = new Mask(FOREST_MASK_NAME, targetProduct.getSceneRasterWidth(),
            targetProduct.getSceneRasterHeight(), Mask.BandMathsType.INSTANCE);

    mask.setDescription("Forest Area");
    mask.getImageConfig().setValue("color", Color.MAGENTA);
    mask.getImageConfig().setValue("transparency", 0.7);
    mask.getImageConfig().setValue("expression", expression);
    mask.setNoDataValue(0);
    mask.setNoDataValueUsed(true);
    targetProduct.getMaskGroup().add(mask);
    /*
    final Band targetBandMask = new Band(FOREST_MASK_NAME,
                                     ProductData.TYPE_INT8,
                                     sourceImageWidth,
                                     sourceImageHeight);
            
    targetBandMask.setNoDataValue(-1);
    targetBandMask.setNoDataValueUsed(true);
    targetBandMask.setUnit(Unit.AMPLITUDE);
    targetProduct.addBand(targetBandMask);
    */
}

From source file:no.uio.medicine.virsurveillance.charts.StackedChart_AWT.java

private Color getColor(int index) {
    int index2 = index + this.colorOffset;
    switch (index2) {
    case 0:/* ww w.  j  a va 2 s .c om*/
        return Color.RED;
    case 1:
        return Color.BLUE;
    case 2:
        return Color.GREEN;
    case 3:
        return Color.YELLOW;
    case 4:
        return Color.DARK_GRAY;
    case 5:
        return Color.ORANGE;
    case 6:
        return Color.BLACK;
    case 7:
        return Color.CYAN;
    case 8:
        return Color.GRAY;
    case 9:
        return Color.LIGHT_GRAY;
    case 10:
        return Color.MAGENTA;
    case 11:
        return Color.PINK;
    case 12:
        return Color.WHITE;
    default:
        return getColor((int) Math.floor(Math.random() * 14));
    }

}