Example usage for java.awt Color cyan

List of usage examples for java.awt Color cyan

Introduction

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

Prototype

Color cyan

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

Click Source Link

Document

The color cyan.

Usage

From source file:org.adempiere.apps.graph.ChartBuilder.java

private void setupCategoryChart(JFreeChart chart) {
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis xAxis = (CategoryAxis) plot.getDomainAxis();
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.BLUE);
    renderer.setSeriesPaint(2, Color.YELLOW);
    renderer.setSeriesPaint(3, Color.GREEN);
    renderer.setSeriesPaint(4, Color.ORANGE);
    renderer.setSeriesPaint(5, Color.CYAN);
    renderer.setSeriesPaint(6, Color.MAGENTA);
    renderer.setSeriesPaint(7, Color.GRAY);
    renderer.setSeriesPaint(8, Color.PINK);

    plot.setRenderer(renderer);/*from  ww  w .j a  v  a2s  .  c  o  m*/
}

From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java

public static void drawShapes(Graphics2D g2, Rectangle2D imageArea, Shape shape, JFreeChart chart) {
    Color color = Color.CYAN;
    Stroke oldStroke = g2.getStroke();
    g2.setStroke(new BasicStroke(2f));
    drawShape(g2, imageArea, shape, color, chart);
    g2.setStroke(oldStroke);/*from   w w  w .  java 2  s  .  c o  m*/
}

From source file:whitebox.stats.Kriging.java

/**
 * Draw Semivariogram surface map and also draw the search are if
 * Anisotropic//from   w  w  w. ja v a  2 s .  c om
 *
 * @param Radius
 * @param AnIsotropic
 */
public void DrawSemivariogramSurface(double Radius, boolean AnIsotropic) {
    double[][] data = new double[3][BinSurface.length * BinSurface[0].length];
    int n = 0;
    double max = Double.MIN_VALUE;
    for (int i = 0; i < BinSurface.length; i++) {
        for (int j = 0; j < BinSurface[i].length; j++) {
            data[0][n] = BinSurface[i][j].GridHorDistance;
            data[1][n] = BinSurface[i][j].GridVerDistance;
            if ((Math.pow(data[0][n], 2) + Math.pow(data[1][n], 2)) <= Radius * Radius
                    && !Double.isNaN(BinSurface[i][j].Value)) {
                data[2][n] = BinSurface[i][j].Value;
                if (max < data[2][n]) {
                    max = data[2][n];
                }
            } else {
                data[2][n] = -1;
            }
            n++;
        }
    }
    DefaultXYZDataset dataset = new DefaultXYZDataset();
    dataset.addSeries("Value", data);
    NumberAxis xAxis = new NumberAxis();

    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);
    NumberAxis yAxis = new NumberAxis();
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setLowerMargin(0.0);
    yAxis.setUpperMargin(0.0);
    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(LagSize);
    renderer.setBlockHeight(LagSize);
    renderer.setBlockAnchor(RectangleAnchor.CENTER);

    LookupPaintScale paintScale = new LookupPaintScale(0, max, Color.white);
    double colorRange = max / 6;
    //double colorRange = 23013;
    paintScale.add(0.0, Color.blue);
    paintScale.add(1 * colorRange, Color.green);
    paintScale.add(2 * colorRange, Color.cyan);
    paintScale.add(3 * colorRange, Color.yellow);
    paintScale.add(4 * colorRange, Color.ORANGE);
    paintScale.add(5 * colorRange, Color.red);

    renderer.setPaintScale(paintScale);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinePaint(Color.white);

    if (AnIsotropic) {
        CombinedRangeXYPlot combinedrangexyplot = new CombinedRangeXYPlot();
        XYSeries seriesT1 = new XYSeries("1");
        XYSeriesCollection AngleCollct = new XYSeriesCollection();

        double bw = BandWidth;
        double r = bw / Math.sin(Tolerance);
        if (r > Radius) {
            bw = Radius * Math.sin(Tolerance);
            r = Radius;
        }
        seriesT1.add(r * Math.cos(Angle + Tolerance), r * Math.sin(Angle + Tolerance));

        if ((double) Math.round(Math.sin(Angle) * 10000) / 10000 != 0) {
            if ((double) Math.round(Math.cos(Angle) * 10000) / 10000 != 0) {
                double a = (1 + Math.pow(Math.tan(Angle), 2));
                double b = 2 * bw / Math.sin(Angle) * Math.pow(Math.tan(Angle), 2);
                double c = Math.pow(Math.tan(Angle), 2) * Math.pow(bw / Math.sin(Angle), 2)
                        - Math.pow(Radius, 2);
                double x1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y1 = Math.tan(Angle) * (x1 + bw / Math.sin(Angle));
                double x2 = (-b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y2 = Math.tan(Angle) * (x2 + bw / Math.sin(Angle));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));
                if (d1 < d2) {
                    seriesT1.add(x1, y1);
                } else {
                    seriesT1.add(x2, y2);
                }
            } else {
                double x1 = -bw * Math.sin(Angle);
                double y1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double y2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));

                if (d1 < d2) {
                    seriesT1.add(x1, y1);
                } else {
                    seriesT1.add(x1, y2);
                }
            }
        } else {
            double y1 = bw * Math.cos(Angle);
            double x1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double x2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
            double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));

            if (d1 < d2) {
                seriesT1.add(x1, y1);
            } else {
                seriesT1.add(x2, y1);
            }
        }

        AngleCollct.addSeries(seriesT1);

        XYSeries seriesT2 = new XYSeries("2");
        seriesT2.add(r * Math.cos(Angle + Tolerance), r * Math.sin(Angle + Tolerance));
        seriesT2.add(0.0, 0.0);
        AngleCollct.addSeries(seriesT2);

        XYSeries seriesT3 = new XYSeries("3");
        seriesT3.add(Radius * Math.cos(Angle), Radius * Math.sin(Angle));
        seriesT3.add(0, 0);
        AngleCollct.addSeries(seriesT3);

        XYSeries seriesT4 = new XYSeries("4");
        seriesT4.add(r * Math.cos(Angle - Tolerance), r * Math.sin(Angle - Tolerance));
        seriesT4.add(0, 0);
        AngleCollct.addSeries(seriesT4);

        XYSeries seriesT5 = new XYSeries("5");

        seriesT5.add(r * Math.cos(Angle - Tolerance), r * Math.sin(Angle - Tolerance));
        if ((double) Math.round(Math.sin(Angle) * 10000) / 10000 != 0) {
            if ((double) Math.round(Math.cos(Angle) * 10000) / 10000 != 0) {
                double a = (1 + Math.pow(Math.tan(Angle), 2));
                double b = -2 * bw / Math.sin(Angle) * Math.pow(Math.tan(Angle), 2);
                double c = Math.pow(Math.tan(Angle), 2) * Math.pow(bw / Math.sin(Angle), 2)
                        - Math.pow(Radius, 2);
                double x1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y1 = Math.tan(Angle) * (x1 - bw / Math.sin(Angle));
                double x2 = (-b - Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / (2 * a);
                double y2 = Math.tan(Angle) * (x2 - bw / Math.sin(Angle));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));
                if (d1 < d2) {
                    seriesT5.add(x1, y1);
                } else {
                    seriesT5.add(x2, y2);
                }
            } else {
                double x1 = bw * Math.sin(Angle);
                double y1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double y2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(x1, 2));
                double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
                double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                        + (Math.pow((Radius * Math.sin(Angle) - y2), 2)));

                if (d1 < d2) {
                    seriesT5.add(x1, y1);
                } else {
                    seriesT5.add(x1, y2);
                }
            }
        } else {
            double y1 = -bw * Math.cos(Angle);
            double x1 = Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double x2 = -Math.sqrt(Math.pow(Radius, 2) - Math.pow(y1, 2));
            double d1 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x1), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));
            double d2 = Math.sqrt((Math.pow((Radius * Math.cos(Angle) - x2), 2))
                    + (Math.pow((Radius * Math.sin(Angle) - y1), 2)));

            if (d1 < d2) {
                seriesT5.add(x1, y1);
            } else {
                seriesT5.add(x2, y1);
            }
        }
        AngleCollct.addSeries(seriesT5);
        plot.setDataset(1, AngleCollct);
        XYLineAndShapeRenderer lineshapRend = new XYLineAndShapeRenderer(true, false);
        for (int i = 0; i < AngleCollct.getSeriesCount(); i++) {
            //plot.getRenderer().setSeriesPaint(i , Color.BLUE);
            lineshapRend.setSeriesPaint(i, Color.BLACK);
        }
        plot.setRenderer(1, lineshapRend);
        combinedrangexyplot.add(plot);
    }
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    JFreeChart chart = new JFreeChart("Semivariogram Surface", plot);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);

    // create and display a frame...
    ChartFrame frame = new ChartFrame("", chart);
    frame.pack();
    //frame.setSize(100, 50);
    frame.setVisible(true);
}

From source file:net.liuxuan.device.VACVBS.JIF_DrawChart_vacvbs.java

/**
 * ?jfreechart/*w w  w.  jav a 2 s. c  o  m*/
 */
public void initChart() {
    ts_LP = new TimeSeries("LowPressure", Millisecond.class);
    ts_HP = new TimeSeries("HighPressure", Millisecond.class);
    ts_humidity = new TimeSeries("Humidity", Millisecond.class);
    ts_temprature = new TimeSeries("Temperature", Millisecond.class);
    ts_time = new TimeSeries("TestTime", Millisecond.class);
    ts_num = new TimeSeries("num", Millisecond.class);
    ts_reserved1 = new TimeSeries("reserved1", Millisecond.class);
    ts_reserved2 = new TimeSeries("reserved2", Millisecond.class);
    ts_reserved3 = new TimeSeries("reserved3", Millisecond.class);
    trcollection = new TimeSeriesCollection(ts_LP);

    trcollection.addSeries(ts_HP);

    trcollection2 = new TimeSeriesCollection(ts_humidity);

    trcollection2.addSeries(ts_temprature);

    //        trcollection2.addSeries(ts_num);
    //        trcollection2.addSeries(ts_time);
    //trcollection2.addSeries(ts_reserved1);
    //trcollection2.addSeries(ts_reserved2);
    //trcollection2.addSeries(ts_reserved3);

    //        timeseriescopylist.add(getTimeSeries(3).createCopy(0, getTimeSeries(3).getItemCount() - 1));
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("", "Time(s)", "PPM", trcollection,
            true, true, false);
    XYPlot xyplot = jfreechart.getXYPlot();

    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    Font fs = new Font("", Font.BOLD, 14);
    Font fs2 = new Font("", Font.BOLD, 12);

    XYLineAndShapeRenderer line0render = (XYLineAndShapeRenderer) xyplot.getRenderer(0);

    Color purple = new Color(139, 0, 255);

    line0render.setSeriesPaint(0, Color.blue);
    line0render.setSeriesPaint(1, Color.green);
    line0render.setSeriesPaint(2, Color.red);
    line0render.setSeriesPaint(3, purple);

    //        line0render.setSeriesPaint(3, Color.ORANGE);
    XYLineAndShapeRenderer line1render = new XYLineAndShapeRenderer();
    Color Rosered = new Color(230, 28, 100);
    line1render.setSeriesPaint(0, Color.cyan);
    line1render.setSeriesPaint(1, Rosered);
    line1render.setSeriesPaint(2, Color.orange);
    line1render.setSeriesPaint(3, Color.yellow);
    line1render.setBaseShapesVisible(false);
    xyplot.setRenderer(1, line1render);

    //??
    ValueAxis valueaxis = xyplot.getDomainAxis();

    //
    valueaxis.setLabelFont(fs);

    //
    valueaxis.setTickLabelFont(fs2);

    ValueAxis valueaxis2 = new NumberAxis("");
    valueaxis2.setLabelFont(fs);
    valueaxis2.setTickLabelFont(fs2);

    xyplot.setRangeAxis(1, valueaxis2);
    xyplot.setDataset(1, trcollection2);
    xyplot.mapDatasetToRangeAxis(1, 1);

    //??
    valueaxis.setAutoRange(true);
    //?? 7days
    //                valueaxis.setFixedAutoRange(604800000D);
    valueaxis = xyplot.getRangeAxis();

    valueaxis.setLabelFont(new Font("", Font.BOLD, 14));
    valueaxis.setLabelPaint(line0render.getSeriesPaint(0));
    valueaxis2.setLabelPaint(line1render.getSeriesPaint(0));

    jfreechart.getTitle().setFont(new Font("", Font.BOLD, 20));//
    jfreechart.getLegend().setItemFont(new Font("", Font.ITALIC, 15));
    xyplot.getRenderer(0).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}",
            new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000")));
    xyplot.getRenderer(1).setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator("{1}, {2}",
            new SimpleDateFormat("MM-dd HH:mm:ss"), new DecimalFormat("0.0000")));
    chartPanel = new ChartPanel(jfreechart);

    initChartMenu();
    //        chartPanel.getPopupMenu().add(jmenuitem2);
    //        chartPanel.getPopupMenu().getPopupMenuListeners();

    chartPanel.setSize(950, 620);
    chartPanel.setPreferredSize(new Dimension(950, 620));
    jPanel_Show.add(chartPanel, BorderLayout.CENTER);
}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createWaterfallChart(CategoryDataset dataset) {

    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);

    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);

    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, Math.PI / 2.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    }/*from ww  w. ja  va2 s .c  o m*/
    if (tooltips) {
        StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator();
        renderer.setBaseToolTipGenerator(generator);
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart("Waterfall Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    //        GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    //        AbstractRenderer#setSeriesPaint(int, Paint) are ignored;
    //        renderer.setSeriesPaint(0, gp0);
    //        renderer.setSeriesPaint(1, gp1);
    //        renderer.setSeriesPaint(2, gp2);

    //??
    renderer.setFirstBarPaint(gp0);
    renderer.setLastBarPaint(gp2);
    renderer.setPositiveBarPaint(Color.orange);
    renderer.setNegativeBarPaint(Color.cyan);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    return chart;

}

From source file:org.mathIT.gui.GraphViewer.java

/**
 * Gets relevance clusters for this graph and marks them in the canvas. 
 *///from w  w w  .  j  a  v a  2 s  .  c o m
private void displayRelevanceClusters() {
    ArrayList<OrderedSet<Integer>> list = invokerGraph.getRelevanceClusters().getClusters();

    // Change the vertex color palette to mark the most relevant vertices red:
    palette = new java.awt.Color[] { java.awt.Color.YELLOW, // category 0
            java.awt.Color.BLUE, // category 1
            java.awt.Color.GREEN, // category 2
            java.awt.Color.MAGENTA, // category 3 
            java.awt.Color.RED, // category 4
            java.awt.Color.ORANGE, java.awt.Color.CYAN, java.awt.Color.LIGHT_GRAY, java.awt.Color.PINK,
            java.awt.Color.BLACK };

    // add a listener for ToolTips
    canvas.setVertexToolTipTransformer(new ToStringLabeller<V>() {
        /* (non-Javadoc)
         * @see edu.uci.ics.jung.visualization.decorators.DefaultToolTipFunction#getToolTipText(java.lang.Object)
         */
        @Override
        @SuppressWarnings("unchecked")
        public String transform(V v) {
            if (v instanceof Graph) {
                return ((Graph<V>) v).getVertices().toString();
            }
            //return super.transform((V) v);
            return "Network relevance: "
                    + org.mathIT.util.Formats.O_DOT_A3.format(invokerGraph.getRelevance(v.getIndex()));
        }
    });
    // ---- Vertex color: ----
    canvas.getRenderer().setVertexRenderer(new VertexFillColor(list));
    canvas.repaint();
}

From source file:com.voterData.graph.Graph.java

public static JFreeChart getRaceDistbn2012(Map<String, Double> dataMap) {
    DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
    for (String key : dataMap.keySet()) {
        if (key.equals("A_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "REP");
        } else if (key.equals("B_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "REP");
        } else if (key.equals("I_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "REP");
        } else if (key.equals("O_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "REP");
        } else if (key.equals("M_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "REP");
        } else if (key.equals("U_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "REP");
        } else if (key.equals("W_Rep_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "REP");
        } else if (key.equals("A_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "DEM");
        } else if (key.equals("B_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "DEM");
        } else if (key.equals("I_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "DEM");
        } else if (key.equals("O_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "DEM");
        } else if (key.equals("M_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "DEM");
        } else if (key.equals("U_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "DEM");
        } else if (key.equals("W_Dem_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "DEM");
        } else if (key.equals("A_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Asian", "UNA");
        } else if (key.equals("B_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "African American/Black", "UNA");
        } else if (key.equals("I_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "American Indian/Alaska Native", "UNA");
        } else if (key.equals("O_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Other", "UNA");
        } else if (key.equals("M_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Multiracial", "UNA");
        } else if (key.equals("U_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "Undefined", "UNA");
        } else if (key.equals("W_Una_2012")) {
            defaultcategorydataset.addValue(dataMap.get(key), "White", "UNA");
        }/*w w w  . j a  v  a 2s .c  o  m*/
    }

    JFreeChart jfreechart = ChartFactory.createBarChart("Race Distribution - 2012", "Party", "% of votes",
            defaultcategorydataset, PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    BarRenderer renderer = (BarRenderer) categoryplot.getRenderer();

    renderer.setDrawBarOutline(false);
    renderer.setSeriesPaint(0, Color.cyan);
    renderer.setSeriesPaint(1, Color.pink);
    renderer.setSeriesPaint(2, Color.red);
    renderer.setSeriesPaint(3, Color.orange);
    renderer.setSeriesPaint(4, Color.green);
    renderer.setSeriesPaint(5, Color.yellow);
    renderer.setSeriesPaint(6, Color.magenta);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
    renderer.setItemLabelsVisible(true);
    categoryplot.setRenderer(renderer);

    return jfreechart;

}

From source file:ngat.opsgui.xcomp.SeeingPanel2.java

private void updateSeeingCategory(double seeing) {
    if (seeing < 0.8) {
        categoryField.setText("GOOD");
        categoryField.setBackground(Color.green);
    } else if (seeing < 1.3) {
        categoryField.setText("AVERAGE");
        categoryField.setBackground(Color.orange);
    } else if (seeing < 2.0) {
        categoryField.setText("POOR");
        categoryField.setBackground(Color.red);
    } else {/*from   w w  w .j av  a  2 s  .co m*/
        categoryField.setText("USABLE");
        categoryField.setBackground(Color.cyan.darker());
    }
}

From source file:edu.ucla.stat.SOCR.analyses.gui.SimpleLinearRegression.java

protected void doGraph() {
    // graphComponent is available here
    // data: variables double xData, yData, residuals, predicted are available here after doAnalysis() is run.
    //////System.out.println("start doGraph 1");
    graphPanel.removeAll();//from w ww. j a v  a2  s  . c  o  m

    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));
    //ScrollPaneLayout scrollPaneLayout = new ScrollPaneLayout();
    //graphPane.setScrollPaneLayout(scrollPaneLayout.VERTICAL_SCROLLBAR_ALWAYS);
    //graphPane.setLayout(scrollPaneLayout);

    // 1. scatter plot of data: yData vs. xData
    /*JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs X " + independentHeader, independentHeader, dependentHeader, xData, yData);//getChart(title, xlabel, ylabel, xdata,ydata)
    ChartPanel chartPanel = new ChartPanel(scatterChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
    innerPanel.add(chartPanel);*/

    JFreeChart scatterChart = chartFactory.getQQChart(
            "Scatter Plot of " + dependentHeader + " vs " + independentHeader, independentHeader,
            dependentHeader, dependentHeader + " Value  ", xData, yData, "Regression Line", intercept, slope,
            "");
    ChartPanel chartPanel = new ChartPanel(scatterChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    Color[] colorArray = new Color[] { Color.CYAN, Color.BLUE, Color.CYAN };

    // 1.5 add prediction interval
    scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs " + independentHeader,
            independentHeader, dependentHeader, dependentHeader + " Value  ", xData, yData, "Regression Line",
            intercept, slope, "");
    double[][] xArray = new double[3][];
    xArray[0] = xData;
    xArray[1] = xData;
    xArray[2] = xData;
    double[][] yArray = new double[3][];
    yArray[0] = predictedUpper;
    yArray[1] = predicted;
    yArray[2] = predictedLower;
    int lineSetCount = 3; // 3 lines >///<
    String[] groupNames = { "Predicted + 2 SE", "Predicted", "Predicted - 2 SE" };

    String[] dotGroupNames = { "Observed" };
    double[][] xDataDot = new double[1][];
    double[][] yDataDot = new double[1][];
    xDataDot[0] = xData;
    yDataDot[0] = yData;
    Color[] dotColor = { Color.RED };
    for (int i = 0; i < predictedUpper.length; i++) {
        //System.out.print(varPredict[i]);
        //System.out.print(", " + sdPredict[i]);
        //System.out.print(", " + predictedLower[i]);
        //System.out.print(", " + predicted[i]);
        //System.out.print(", " + predictedUpper[i] + "\n");
    }

    //double[][] lineX  --double[number of line][number of dots in line]
    //double[][] dotX  --double[number of dots group][number of dots in the group]
    // "other" can be "nolegend" to turn off the legend box at the buttom

    /* public JFreeChart getLineAndDotChart(
     String title,
     String xLabel,
     String yLabel,
     int numberOfLines,
     String[] lineNames,
     double[][] lineX,
     double[][] lineY,
     Color[] lineColors,
            
       int numberOfDotsGroups,
       String[] dotGroupNames,
       double[][] dotX,
       double[][] dotY,
       Color[] dotColors,
       String other){
    */

    //try {
    scatterChart = chartFactory.getLineAndDotChart("Scatter Plot with Predition Interval", independentHeader,
            dependentHeader, lineSetCount, groupNames, xArray, yArray, colorArray, 1, dotGroupNames, xDataDot,
            yDataDot, dotColor, "excludeszero");
    chartPanel = new ChartPanel(scatterChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);
    //} catch (Exception e) {
    //   ////System.out.println("getLineAndDotChart e = " + e);
    //}

    // 2. residual on Covariate plot: residuals vs. xData
    JFreeChart rxChart = chartFactory.getQQChart("Residual on Covariate Plot", independentHeader, "Residuals",
            "Residual Value  ", xData, residuals, "At Residual = 0", 0, 0, "");
    chartPanel = new ChartPanel(rxChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    // 3. residual on fit plot: residuals vs. xData
    JFreeChart residualOnFitChart = chartFactory.getQQChart("Residual on Fit Plot",
            "Predicted " + dependentHeader, "Residuals", "Residual Value  ", predicted, residuals,
            "At Residual = 0", 0, 0, "excludeszero");
    ////////System.out.println("predicted min = " + AnalysisUtility.min(predicted));
    ////////System.out.println("predicted max = " + AnalysisUtility.max(predicted));
    chartPanel = new ChartPanel(residualOnFitChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    //JFreeChart scatterChart = chartFactory.getLineChart("Residual on Covariate Plot, Residual vs. " + independentHeaderArray[i], independentHeaderArray[i], dependentHeader, xDataDouble, residuals);
    // 4. Normal QQ plot: need residuals and standardized normal scores

    //JFreeChart qqChart = chartFactory.getQQChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", "Standardized Residual Value  ", sortedNormalQuantiles, sortedStandardizedResiduals,  "At Standardized Residual = 0", 0, 0, "");
    //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals);
    //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedNormalQuantiles, sortedStandardizedResiduals);
    JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles",
            "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "noline");
    chartPanel = new ChartPanel(qqChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    // 5. scale-location plot -- maybe later.

    graphPanel.validate();

}

From source file:gdsc.smlm.ij.plugins.SpotAnalysis.java

private void showProfile(String title, double[] xValues, double[] yValues, double[] yValues2) {
    Plot2 plot = new Plot2(title, "Frame", "Signal", xValues, yValues);
    double[] limits = Maths.limits(yValues);
    plot.setLimits(xValues[0], xValues[xValues.length - 1], limits[0], limits[1]);
    plot.draw();//w  ww.  ja v  a2 s. c  om

    plot.setColor(Color.red);
    plot.addPoints(xValues, yValues2, Plot2.LINE);

    plot.setColor(Color.magenta);

    // Add the on-frames
    if (!onFrames.isEmpty()) {
        double[] onx = new double[onFrames.size()];
        double[] ony = new double[onx.length];
        int c = 0;
        for (Spot s : onFrames) {
            onx[c] = s.frame;
            ony[c] = yValues[s.frame - 1];
            c++;
        }
        plot.addPoints(onx, ony, Plot2.CIRCLE);
    }

    // Add the candidate frames
    if (!candidateFrames.isEmpty()) {
        plot.setColor(Color.cyan);
        double[] onx = new double[candidateFrames.size()];
        double[] ony = new double[onx.length];
        int c = 0;
        for (int i : candidateFrames) {
            onx[c] = i;
            ony[c] = yValues[i - 1];
            c++;
        }
        plot.addPoints(onx, ony, Plot2.BOX);
        plot.setColor(Color.magenta);
    }

    // Overlay current position
    plot.addPoints(new double[] { rawImp.getCurrentSlice(), rawImp.getCurrentSlice() }, limits, Plot2.LINE);

    plot.setColor(Color.blue);
    Utils.display(title, plot);
}