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:net.sf.dynamicreports.test.jasper.chart.AreaChartTest.java

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.areaChart().setCategory(column1).series(cht.serie(column2))
                    .setCategoryAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                            .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                            .setTickLabelColor(Color.CYAN).setTickLabelRotation(45d)
                            .setLineColor(Color.LIGHT_GRAY)),
                    cht.areaChart().setCategory(column1).series(cht.serie(column2))
                            .setValueAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.stackedAreaChart().setCategory(column1).series(cht.serie(column2))
                    .setCategoryAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                            .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                            .setTickLabelColor(Color.CYAN).setTickLabelRotation(45d)
                            .setLineColor(Color.LIGHT_GRAY)),
                    cht.stackedAreaChart().setCategory(column1).series(cht.serie(column2))
                            .setValueAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}

From source file:com.bdb.weather.display.summary.TemperatureBinSummaryPlot.java

public TemperatureBinSummaryPlot() {
    plot = new CombinedDomainCategoryPlot();
    JFreeChart chart = new JFreeChart(plot);
    setMaxHeight(10000);/*from w w  w  . j  a va  2s .com*/
    setMaxWidth(10000);

    NumberAxis countAxis = new NumberAxis("Day Count");
    countAxis.setUpperMargin(.2);
    countPlot.setRangeAxis(countAxis);
    countPlot.setDataset(countDataset);

    BarRenderer r = new BarRenderer();
    r.setBaseItemLabelsVisible(true);
    r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    r.setSeriesPaint(0, Color.BLUE);
    r.setBasePaint(Color.BLUE);
    countPlot.setRenderer(r);

    NumberAxis durationAxis = new NumberAxis("Duration (Hours)");
    durationAxis.setUpperMargin(.2);
    durationPlot.setRangeAxis(durationAxis);
    durationPlot.setDataset(durationDataset);
    r = new BarRenderer();
    r.setBaseItemLabelsVisible(true);
    NumberFormat format = DecimalFormat.getNumberInstance();
    format.setMaximumFractionDigits(1);
    format.setMinimumFractionDigits(1);
    r.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, format));
    r.setSeriesPaint(0, Color.RED);
    r.setBasePaint(Color.RED);
    durationPlot.setRenderer(r);

    plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    plot.add(countPlot);
    plot.add(durationPlot);

    chartViewer = new ChartViewer(chart);
    this.setCenter(chartViewer);
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.xyStepChart().setXValue(column1).series(cht.xySerie(column2)).setStepPoint(0.5d), cht
                    .xyStepChart().setXValue(column1).series(cht.xySerie(column2))
                    .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                            .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                            .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.xyStepChart().setXValue(column1).series(cht.xySerie(column2))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}

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

public ChartPanel get_ChartPanel(int width, int height) {
    chr = new ChartPanel(chart);
    chr.setBackground(Color.blue);

    chr.setBounds(5, 5, width - 5, height - 10);
    chr.setVisible(true);//from www .j a va  2 s . co m
    chr.setMouseWheelEnabled(true);
    chr.addChartMouseListener(new ChartMouseListener() {

        public void chartMouseMoved(ChartMouseEvent chartmouseevent) {

        }

        public void chartMouseClicked(ChartMouseEvent chartmouseevent) {

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    XYPlot xyplot = (XYPlot) chr.getChart().getPlot();
                    xyplot.clearAnnotations();
                    double x, y;
                    x = new BigDecimal(xyplot.getDomainCrosshairValue()).setScale(3, RoundingMode.UP)
                            .doubleValue();

                    y = new BigDecimal(xyplot.getRangeCrosshairValue()).setScale(3, RoundingMode.UP)
                            .doubleValue();
                    XYTextAnnotation annotation = new XYTextAnnotation("(" + x + ", " + y + ")",
                            new BigDecimal(x).setScale(3, RoundingMode.UP).doubleValue(), y);
                    annotation.setFont(new Font("serif", Font.BOLD, 15));
                    annotation.setTextAnchor(TextAnchor.BOTTOM_CENTER);
                    xyplot.addAnnotation(annotation);
                }
            });
        }
    });

    return chr;
}

From source file:com.sciaps.common.RegionMarkerItem.java

private void createMarker() {
    final Color c = new Color(8, 255, 8, 63);
    marker_ = new IntervalMarker(min_, max_, c, new BasicStroke(2.0f), null, null, 1.0f);
    String[] tmp = name_.split("-");
    marker_.setLabel(tmp[0]);/* w ww .java 2 s  .c  o m*/
    marker_.setLabelPaint(Color.blue);
    marker_.setLabelFont(new java.awt.Font("Tahoma", 1, 14));
    marker_.setLabelOffset(new RectangleInsets(50, 10, 10, 20));
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2)).setShowLabels(true)
    /*.setShowTickLabels(false)
    .setShowTickMarks(false)*/, cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2))
            .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                    .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}

From source file:diplomawork.model.ViewForDiagram.java

/**
 * Creates a chart./*ww  w  .ja  v  a 2 s .  c o m*/
 *
 * @param dataset a dataset.
 *
 * @return A chart.
 */
private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart("EUR/USD", // title
            "Date", // x-axis label
            "Price Per Unit", // y-axis label
            dataset, // data
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    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.setOutlinePaint(null);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
        renderer.setSeriesPaint(0, Color.BLUE);
    }
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("dd HH:mm:ss"));
    return chart;
}

From source file:trendgraph.XYLineChart_AWT.java

public XYLineChart_AWT(int yearStart, int yearEnd, String[] creditUnionName, String columnName)
        throws SQLException {
    super("Graph");
    super.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.yearStart = yearStart;
    this.yearEnd = yearEnd;
    this.creditUnionName = creditUnionName;
    this.columnName = columnName;
    saveGraphButton = new JButton("Save Graph");
    saveGraphButton.setBorderPainted(false);
    saveGraphButton.setFocusPainted(false);

    JFreeChart xylineChart = ChartFactory.createXYLineChart("CU Report", "Year (YYYY)", //X-axis
            columnName, //Y-axis (replace with columnName
            createDataset(), PlotOrientation.VERTICAL, true, true, false);

    ChartPanel chartPanel = new ChartPanel(xylineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1000, 800)); //(x, y)
    final XYPlot plot = xylineChart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

    renderer.setSeriesPaint(0, Color.RED); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(0, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(1, Color.BLUE); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(1, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(2, Color.GREEN); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(2, new BasicStroke(3.0f)); //Font size

    renderer.setSeriesPaint(3, Color.yellow); //can be GREEN, YELLOW, ETC.

    renderer.setSeriesStroke(3, new BasicStroke(3.0f)); //Font size

    plot.setRenderer(renderer);//from www .  j  a  v a2s  . c  o  m
    chartPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    chartPanel.add(saveGraphButton);
    setContentPane(chartPanel);
    pack();
    RefineryUtilities.centerFrameOnScreen(this);
    setVisible(true);

    saveGraphButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Rectangle rect = chartPanel.getBounds();
            FileChooser chooser = new FileChooser();

            //get chosen path and save the variable
            String path = chooser.getPath();
            path = path.replace("\\", "/");

            String format = "png";
            String fileName = path + "." + format;
            BufferedImage captureImage = new BufferedImage(rect.width, rect.height,
                    BufferedImage.TYPE_INT_ARGB);
            chartPanel.paint(captureImage.getGraphics());

            File file = new File(fileName);

            try {
                ImageIO.write(captureImage, format, file);

                //write data to file
            } catch (IOException ex) {
                Logger.getLogger(XYLineChart_AWT.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

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(//ww  w .  ja  va 2  s  .c  o  m
                    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))));
}