Example usage for java.awt Color blue

List of usage examples for java.awt Color blue

Introduction

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

Prototype

Color blue

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

Click Source Link

Document

The color blue.

Usage

From source file:weka.core.ChartUtils.java

/**
 * Generates a heat map from a matrix of correlations
 * //www.  ja  v  a2s .  c  om
 * @param matrix a Matrix (expected to hold correlation values between -1 and
 *          1)
 * @param rowAttNames a list of labels for the columns/rows
 * @return an Image holding the heat map
 */
public static Image getHeatMapForMatrix(Matrix matrix, List<String> rowAttNames) {

    double[][] m = matrix.getArray();

    // generate the heat map
    // need to reverse the order of the rows
    double[][] mm = new double[m.length][];
    for (int i = 0; i < m.length; i++) {
        mm[m.length - 1 - i] = m[i];
    }
    String[] xLabels = new String[rowAttNames.size()];
    String[] yLabels = new String[rowAttNames.size()];
    for (int i = 0; i < rowAttNames.size(); i++) {
        xLabels[i] = rowAttNames.get(i);
        yLabels[rowAttNames.size() - 1 - i] = rowAttNames.get(i);
    }
    HeatChart map = new HeatChart(mm, true);
    map.setTitle("Correlation matrix heat map");
    map.setCellSize(new java.awt.Dimension(30, 30));
    map.setHighValueColour(java.awt.Color.RED);
    map.setLowValueColour(java.awt.Color.BLUE);
    map.setXValues(xLabels);
    map.setYValues(yLabels);

    return map.getChartImage();
}

From source file:web.diva.server.model.pca.PCAImageGenerator.java

public PCAImageGenerator(PcaResults pcaResults, DivaDataset divaDataset, int pcax, int pcay) {
    this.divaDataset = divaDataset;
    this.pcaResults = pcaResults;
    this.pcax = pcax;
    this.pcay = pcay;
    this.plot = new PcaPlot();
    plot.setMaximumSize(new Dimension(32767, 32767));
    plot.setMinimumSize(new Dimension(900, 900));
    plot.setPreferredSize(new Dimension(900, 900));
    plot.setBorder(javax.swing.BorderFactory.createLineBorder(Color.BLUE));
    plot.setLayout(new java.awt.FlowLayout(0, 5, 1));
    plot.setSize(900, 900);//from   ww w  . j  av a2  s  .com
    plot.setBackground(Color.WHITE);
    indexToZoomed = new int[divaDataset.getDataLength()];//        
    updatePlot();
    pcaLabelData = new String[pcaResults.eigenvalues.length];
    for (int i = 0; i < pcaResults.eigenvalues.length; i++) {
        pcaLabelData[i] = ("Principal Component nr." + String.valueOf(i + 1) + " - "
                + pcaResults.varianceastr(i) + "% var.");
    }
    double totalvar = 0.0;
    java.text.NumberFormat numformat = java.text.NumberFormat.getNumberInstance(java.util.Locale.US);
    numformat.setMaximumFractionDigits(1);
    if (pcax != pcay) {
        totalvar = pcaResults.varianceaccounted(pcax) + pcaResults.varianceaccounted(pcay);
    } else {
        totalvar = pcaResults.varianceaccounted(pcax);
    }
    totalvarStr = ("Total variance retained: " + numformat.format(totalvar) + "% var.");

}

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

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*from   w w  w. ja  v  a2  s  .c  o m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", AreaRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getCategoryPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:playground.anhorni.counts.StdDevBoxPlot.java

public JFreeChart createChart() {
    DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();

    ArrayList<Double>[] lists = this.createArrayLists();

    // add the collected values to the graph / dataset
    for (int i = 0; i < 24; i++) {
        dataset.add(lists[i], "hour", Integer.toString(i + 1));
    }// w  w w .  ja  v a2  s.  com
    final CategoryAxis xAxis = new CategoryAxis(xlabel);
    xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    //xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    final NumberAxis yAxis = new NumberAxis(ylabel);
    yAxis.setAutoRangeIncludesZero(true);

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    this.chart_ = new JFreeChart(chartTitle, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}

From source file:com.fusesource.forge.jmstest.persistence.rrd.RrdGraphPostProcessor.java

@Override
public void processData() {
    super.processData();
    RrdDb db = getDatabase().getDatabase();

    for (int i = 0; i < db.getArcCount(); i++) {
        Archive arch = db.getArchive(i);
        try {/*from   w  ww.ja v a2  s  . c  o m*/
            for (String dsName : db.getDsNames()) {
                String probeName = getDatabase().getDescriptorByPhysicalName(dsName).getName();
                try {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");

                    StringBuffer title = new StringBuffer(probeName);
                    title.append(" ");
                    title.append(sdf.format(new Date(arch.getStartTime() * 1000)));
                    title.append("-");
                    title.append(sdf.format(new Date(arch.getEndTime() * 1000)));

                    log().info("Creating Graph: " + title);

                    RrdGraphDef graphDef = new RrdGraphDef();

                    graphDef.setTitle(title.toString());
                    graphDef.setTimeSpan(arch.getStartTime(), arch.getEndTime());
                    graphDef.datasource(dsName, getDbFileName(), dsName, ConsolFun.AVERAGE);
                    graphDef.setStep(arch.getArcStep());
                    graphDef.setWidth(800);
                    graphDef.setHeight(600);
                    graphDef.line(dsName, Color.BLUE, probeName, 2.0f);
                    graphDef.setImageFormat("PNG");
                    graphDef.setFilename(getWorkDir().getAbsolutePath() + "/" + probeName + ".png");
                    RrdGraph graph = new RrdGraph(graphDef);
                    BufferedImage bi = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
                    graph.render(bi.getGraphics());
                    createThumbnail(bi, probeName, 40, 30);
                } catch (Exception e) {
                    log().error("Error generating graph for probe " + probeName, e);
                }
            }
        } catch (IOException ioe) {
            log().error("Error retrieving datasource names from RRD database ", ioe);
        }
    }
}

From source file:icaro.aplicaciones.recursos.recursoEstadistica.jFreeChart.demo.PieChartDemo1.java

/**
 * Creates a chart./* ww w .jav  a  2  s  .  c  om*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    //        plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

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

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);//  w w w . ja v  a2  s.  com

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", StackedAreaRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getCategoryPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:graficos.GraficoBarras.java

private static JFreeChart crearGrafico(CategoryDataset cjto_datos) {
    JFreeChart grafico = ChartFactory.createBarChart3D("Distribucin de Recursos", // Ttulo
            "Unidad de tiempo", // Ttulo eje x
            "Recurso", // Ttulo eje y
            cjto_datos, // Datos
            PlotOrientation.VERTICAL, // Orientacin
            true, // Incluir leyenda
            true, // Incluir tooltips
            false // Incluir URLs
    );//from   w ww.ja va  2s. co  m
    grafico.setBackgroundPaint(new Color(240, 240, 240));
    grafico.getPlot().zoom(0.0);
    CategoryPlot ploter = (CategoryPlot) grafico.getPlot();
    NumberAxis3D rangeAxis = (NumberAxis3D) ploter.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis3D.createIntegerTickUnits());
    BarRenderer3D renderer = (BarRenderer3D) ploter.getRenderer();
    renderer.setDrawBarOutline(false);
    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));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setItemMargin(0.0);
    CategoryAxis domainAxis = ploter.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.0));
    return grafico;
}

From source file:org.jfree.chart.demo.selection.SelectionDemo5Category.java

private static JFreeChart createChart(CategoryDataset dataset,
        DatasetSelectionExtension<CategoryCursor<String, String>> ext) {

    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 1", "Category", "Value", dataset);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setDomainGridlinesVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.setRangeCrosshairPaint(Color.blue);

    // set the range axis to display integers only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);/*from   w  w  w .  j av  a 2  s  . c  o m*/

    // set up gradient paints for series...
    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));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    renderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    //add selection specific rendering
    IRSUtilities.setSelectedItemPaint(renderer, ext, Color.WHITE);

    //register plot as selection change listener
    ext.addChangeListener(plot);

    return chart;
}

From source file:org.matsim.counts.algorithms.graphs.BoxPlotErrorGraph.java

@SuppressWarnings("unchecked")
@Override/*from   w w  w .  j  a  v a  2  s . c  o m*/
public JFreeChart createChart(final int nbr) {

    DefaultBoxAndWhiskerCategoryDataset dataset0 = new DefaultBoxAndWhiskerCategoryDataset();
    DefaultBoxAndWhiskerCategoryDataset dataset1 = new DefaultBoxAndWhiskerCategoryDataset();

    final ArrayList<Double>[] listRel = new ArrayList[24];
    final ArrayList<Double>[] listAbs = new ArrayList[24];

    // init
    for (int i = 0; i < 24; i++) {
        listRel[i] = new ArrayList<Double>();
        listAbs[i] = new ArrayList<Double>();
    }

    // add the values of all counting stations to each hour
    for (CountSimComparison cc : this.ccl_) {
        int hour = cc.getHour() - 1;
        listRel[hour].add(cc.calculateRelativeError());
        listAbs[hour].add(cc.getSimulationValue() - cc.getCountValue());
    }

    // add the collected values to the graph / dataset
    for (int i = 0; i < 24; i++) {
        dataset0.add(listRel[i], "Rel Error", Integer.toString(i + 1));
        dataset1.add(listAbs[i], "Abs Error", Integer.toString(i + 1));
    }

    String title = "Iteration: " + this.iteration_;

    final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot();

    final CategoryAxis xAxis = new CategoryAxis("Hour");
    final NumberAxis yAxis0 = new NumberAxis("Signed Rel. Error [%]");
    final NumberAxis yAxis1 = new NumberAxis("Signed Abs. Error [veh]");
    yAxis0.setAutoRangeIncludesZero(false);
    yAxis1.setAutoRangeIncludesZero(false);

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesToolTipGenerator(0, new BoxAndWhiskerToolTipGenerator());

    CategoryPlot subplot0 = new CategoryPlot(dataset0, xAxis, yAxis0, renderer);
    CategoryPlot subplot1 = new CategoryPlot(dataset1, xAxis, yAxis1, renderer);

    plot.add(subplot0);
    plot.add(subplot1);

    final CategoryAxis axis1 = new CategoryAxis("hour");
    axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7));
    axis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    plot.setDomainAxis(axis1);

    this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}