Example usage for java.awt Color lightGray

List of usage examples for java.awt Color lightGray

Introduction

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

Prototype

Color lightGray

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

Click Source Link

Document

The color light gray.

Usage

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

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("US$ Treasury Yields", "Date", "Yield",
            xydataset, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    GregorianCalendar gregoriancalendar = new GregorianCalendar(2005, 10, 15);
    xyplot.setDomainAxis(new CustomDateAxis("Date", gregoriancalendar.getTime()));
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
    }//from w ww .  j  a va2  s .com
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    jfreechart.addSubtitle(new TextTitle("November 2005"));
    TextTitle texttitle = new TextTitle("Source: http://www.econstats.com/r/r_am1.htm");
    texttitle.setFont(new Font("Dialog", 0, 9));
    texttitle.setPosition(RectangleEdge.BOTTOM);
    texttitle.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    jfreechart.addSubtitle(texttitle);
    return jfreechart;
}

From source file:com.csc.GUI.ProfileGUIPanel.java

private JFreeChart createBarChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Expenses Statistics", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );/*from  ww  w  . ja va 2  s  .c  om*/

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

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

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    // OPTIONAL CUSTOMISATION COMPLETED.
    return chart;
}

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

/**
 * Creates a chart./*from w w  w  . j a va2s  .  c  o m*/
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", // 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);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setDefaultShapesVisible(true);
        renderer.setDefaultShapesFilled(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));

    return chart;

}

From source file:org.projectforge.charting.XYChartBuilder.java

public XYChartBuilder(final JFreeChart chart) {
    this.chart = chart;
    plot = chart.getXYPlot();//from   ww w  .  j  a v  a  2  s .co  m
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setOutlineVisible(false);
}

From source file:org.jfree.expdemo.SelectionDemo7ScatterRenderer.java

/**
 * Creates a chart.//from  ww w.ja va2 s .  com
 * 
 * @param dataset
 *            the dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(final MultiValueCategoryDataset dataset,
        final DatasetSelectionExtension ext) {

    ScatterRenderer r = new ScatterRenderer();
    CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), r);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
    JFreeChart chart = new JFreeChart("ScatterRendererDemo1", plot);
    ChartUtilities.applyCurrentTheme(chart);

    //register the plot
    ext.addSelectionChangeListener(plot);

    //illustrates the usage of a shape item rendering strategy
    final CategoryCursor cursor = new CategoryCursor();
    r.setShapeIRS(new DefaultShapeIRS(r) {
        public Shape getItemShape(int row, int column) {
            cursor.setPosition(dataset.getRowKey(row), dataset.getColumnKey(column));
            if (ext.isSelected(cursor)) {
                return new Rectangle2D.Double(-10.0, -10.0, 20.0, 20.0);
            } else {
                return super.getItemShape(row, column);
            }
        }
    });

    return chart;

}

From source file:com.digitalgeneralists.assurance.ui.renderers.ComparisonResultListRenderer.java

public java.awt.Component getTableCellRendererComponent(JTable list, Object value, boolean isSelected,
        boolean cellHasFocus, int row, int column) {
    ComparisonResultPanel panel = new ComparisonResultPanel((ComparisonResult) value);

    if (isSelected) {
        panel.setBackground(list.getSelectionBackground());
        panel.setForeground(list.getSelectionForeground());
    } else {/*  w w w  .j  a  v  a 2 s. c  o m*/
        if ((row % 2.0) == 0) {
            panel.setBackground(Color.white);
        } else {
            panel.setBackground(Color.lightGray);
        }
    }

    list.setRowHeight(row, ((panel.getNumberOfLines() * 18) + 70));

    return panel;
}

From source file:edu.cuny.cat.ui.TraderDistributionPanel.java

public TraderDistributionPanel() {

    registry = GameController.getInstance().getRegistry();
    clock = GameController.getInstance().getClock();

    dataset = new DefaultCategoryDataset();

    setTitledBorder("Trader Distribution");

    chart = ChartFactory.createLineChart("", "", "", dataset, PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(getBackground());
    final CategoryPlot categoryplot = chart.getCategoryPlot();
    categoryplot.setOrientation(PlotOrientation.HORIZONTAL);
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setRangeGridlinePaint(Color.white);
    final LineAndShapeRenderer lineandshaperenderer = (LineAndShapeRenderer) categoryplot.getRenderer();
    UIUtils.setDefaultLineAndShapeRendererStyle(lineandshaperenderer);
    lineandshaperenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    final NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setAutoRangeIncludesZero(false);
    numberaxis.setUpperMargin(0.12D);// w w w  . j  a v a 2 s  .  co m

    final ChartPanel chartPanel = new ChartPanel(chart);
    add(chartPanel, BorderLayout.CENTER);
}

From source file:sanger.team16.gui.genevar.eqtl.snp.RegionalLinePlot.java

private JFreeChart createChart(String chromosome, int position, int distance, double threshold,
        XYDataset dataset) {/*w w  w. j a  v  a  2  s. c o m*/
    JFreeChart chart = ChartFactory.createXYLineChart(null, "Position on chromosome " + chromosome + " (bp)",
            "-log10(P)", dataset, PlotOrientation.VERTICAL, true, true, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.lightGray);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setShapesVisible(true);
    //renderer.setShapesFilled(false);   //CHANGED 12/12/11
    // change the auto tick unit selection to integer units only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    /*       
           XYItemRenderer renderer = plot.getRenderer();  
           int size = dataset.getSeriesCount();
           for (int i=0 ; i<size ; i++) {
    //renderer.setSeriesPaint(i, new Color(255, 0, 0));
    renderer.setSeriesShape(i, ShapeUtilities.createDiamond((float) 3));
    renderer.setBaseSeriesVisibleInLegend(false);
           }
          */
    ValueMarker upperMarker = new ValueMarker(-Math.log10(threshold));
    upperMarker.setPaint(Color.gray);
    float[] f = { 4, 3, 4, 3 };
    upperMarker.setStroke(new BasicStroke(1.0f, 1, 1, 0, f, 1.0f));
    plot.addRangeMarker(upperMarker);

    ValueMarker marker = new ValueMarker(0.0);
    marker.setPaint(Color.lightGray);
    plot.addRangeMarker(marker);

    XYSeries series = new XYSeries("Range");
    series.add(position - distance, -0.05);
    series.add(position + distance, -0.05);
    ((XYSeriesCollection) dataset).addSeries(series);
    renderer.setSeriesVisible(dataset.getSeriesCount() - 1, false, false);

    return chart;
}

From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerAndPredictionDifference.java

private static JFreeChart createChart() {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(NAME, "Power (Watts)", "Power (Watts)", data,
            true, true, false);//from ww  w. j  a va  2s.  co  m
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.yellow, false);
    xydifferencerenderer.setRoundXCoordinates(true);
    xyplot.setDomainCrosshairLockedOnData(true);
    xyplot.setRangeCrosshairLockedOnData(true);
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    xyplot.setRenderer(xydifferencerenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    DateAxis dateaxis = new DateAxis("Samples");
    dateaxis.setTickLabelsVisible(false);
    dateaxis.setLowerMargin(0.0D);
    dateaxis.setUpperMargin(0.0D);
    xyplot.setDomainAxis(dateaxis);
    xyplot.setForegroundAlpha(0.5F);
    return jfreechart;
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createAreaChart("Area Chart", "Category", "Value", categorydataset,
            PlotOrientation.VERTICAL, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    TextTitle texttitle = new TextTitle(
            "An area chart demonstration.  We use this subtitle as an example of what happens when you get a really long title or subtitle.");
    texttitle.setFont(new Font("SansSerif", 0, 12));
    texttitle.setPosition(RectangleEdge.TOP);
    texttitle.setPadding(new RectangleInsets(UnitType.RELATIVE, 0.050000000000000003D, 0.050000000000000003D,
            0.050000000000000003D, 0.050000000000000003D));
    texttitle.setVerticalAlignment(VerticalAlignment.BOTTOM);
    jfreechart.addSubtitle(texttitle);//from  ww  w  .j av  a2s.c  om
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setForegroundAlpha(0.5F);
    categoryplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    categoryplot.setBackgroundPaint(Color.lightGray);
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setDomainGridlinePaint(Color.white);
    categoryplot.setRangeGridlinesVisible(true);
    categoryplot.setRangeGridlinePaint(Color.white);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    categoryaxis.setLowerMargin(0.0D);
    categoryaxis.setUpperMargin(0.0D);
    categoryaxis.addCategoryLabelToolTip("Type 1", "The first type.");
    categoryaxis.addCategoryLabelToolTip("Type 2", "The second type.");
    categoryaxis.addCategoryLabelToolTip("Type 3", "The third type.");
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setLabelAngle(0.0D);
    return jfreechart;
}