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:fitmon.Chart.java

/**
 * Creates a sample chart./*from   w  w w.  ja v  a  2  s .co m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    // 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:edu.ucla.stat.SOCR.chart.demo.XYBarChartDemo1.java

protected JFreeChart createChart(IntervalXYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYBarChart(chartTitle, domainLabel, true, rangeLabel, dataset,
            PlotOrientation.VERTICAL, !legendPanelOn, true, false);

    // then customise it a little...
    // chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();/*from  w w w .j ava2 s  . c om*/
    plot.setRenderer(new ClusteredXYBarRenderer());
    XYItemRenderer renderer = plot.getRenderer();

    StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
    renderer.setBaseToolTipGenerator(generator);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    axis.setLowerMargin(0.01);
    axis.setUpperMargin(0.01);
    //      setXSummary(dataset);  X  is time
    return chart;
}

From source file:plugins.tutorial.chart.ChartTutorial2.java

/**
 * Creates a sample chart./*from   w  ww.j av  a2  s.c om*/
 * 
 * @param dataset
 *        the dataset.
 * @return The chart.
 */
private static JFreeChart createChart(XYDataset xydataset) {

    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Projected Values - Test", "Date",
            "Index Projection", xydataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setInsets(new RectangleInsets(5D, 5D, 5D, 20D));
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    DeviationRenderer deviationrenderer = new DeviationRenderer(true, false);
    deviationrenderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1));
    deviationrenderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1));
    deviationrenderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1));
    deviationrenderer.setSeriesFillPaint(0, new Color(255, 200, 200));
    deviationrenderer.setSeriesFillPaint(1, new Color(200, 200, 255));
    xyplot.setRenderer(deviationrenderer);
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setAutoRangeIncludesZero(false);
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return jfreechart;

}

From source file:edu.ucla.stat.SOCR.chart.demo.HistogramChartDemo3.java

protected JFreeChart createChart(IntervalXYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYBarChart(chartTitle, domainLabel, true, rangeLabel, dataset,
            PlotOrientation.VERTICAL, false, // !legendPanelOn,
            true, false);/* w w  w  . ja  v  a  2 s  .c  o m*/

    // then customise it a little...
    // chart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do"));
    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    plot.setRenderer(new ClusteredXYBarRenderer());
    XYItemRenderer renderer = plot.getRenderer();

    StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0"));
    renderer.setBaseToolTipGenerator(generator);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    axis.setLowerMargin(0.01);
    axis.setUpperMargin(0.01);
    //      setXSummary(dataset);  X  is time
    return chart;
}

From source file:edu.upf.bioevo.manhattanPlotter.QQPlot.java

void drawPlot() {
    int dotRadius;
    int xIncrement = (IMAGE_WIDTH - (xMargin * 2)) / (int) (maxExpectedLogValue + 1);
    int yIncrement = (IMAGE_HEIGHT - (yMargin * 2)) / (int) (maxObservedLogValue + 1);
    Graphics g = image.getGraphics();

    // Cleans image
    g.setColor(Color.WHITE);/*from  w ww .j a  v  a  2s  .  co m*/
    g.fillRect(0, 0, image.getWidth(), image.getHeight());

    // Draws axis lines
    g.setColor(Color.black);
    g.drawLine(xMargin, IMAGE_HEIGHT - yMargin, IMAGE_WIDTH - xMargin, IMAGE_HEIGHT - yMargin);
    g.drawLine(xMargin, IMAGE_HEIGHT - yMargin, xMargin, yMargin);

    // Draws confidence interval
    if (ic95Option) {
        g.setColor(Color.lightGray);
        for (int i = 0; i < upperCI.length - 1; i++) {
            int[] xPoints = { xMargin + (int) (orderedLog10ExpectedValues[i] * xIncrement),
                    xMargin + (int) (orderedLog10ExpectedValues[i] * xIncrement),
                    xMargin + (int) (orderedLog10ExpectedValues[i + 1] * xIncrement),
                    xMargin + (int) (orderedLog10ExpectedValues[i + 1] * xIncrement) };
            int[] yPoints = { IMAGE_HEIGHT - (yMargin + ((int) (upperCI[i] * yIncrement))),
                    IMAGE_HEIGHT - (yMargin + ((int) (lowerCI[i] * yIncrement))),
                    IMAGE_HEIGHT - (yMargin + ((int) (lowerCI[i + 1] * yIncrement))),
                    IMAGE_HEIGHT - (yMargin + ((int) (upperCI[i + 1] * yIncrement))) };

            g.fillPolygon(xPoints, yPoints, 4);
        }
    }

    // Draws dots
    dotRadius = 4;
    g.setColor(Color.black);
    for (int i = 0; i < orderedLog10ObservedValues.length; i++) {
        int xPosition = xMargin + ((int) (orderedLog10ExpectedValues[i] * xIncrement));
        int yPosition = IMAGE_HEIGHT - (yMargin + ((int) (orderedLog10ObservedValues[i] * yIncrement)));
        g.fillOval(xPosition - dotRadius, yPosition - dotRadius, dotRadius * 2, dotRadius * 2);
    }

    // --draw y axis scale
    // ----Calculates interval between labels in y axis
    int yInterval = 1;
    int verticalMaxValue = (int) maxObservedLogValue + 1;

    if (verticalMaxValue > 20) {
        yInterval = 5;
    }
    if (verticalMaxValue > 100) {
        yInterval = 50;
    }
    if (verticalMaxValue > 1000) {
        yInterval = verticalMaxValue;
    }

    g.setColor(Color.BLACK);
    for (int i = 0; i <= verticalMaxValue; i = i + yInterval) {
        int yPos = IMAGE_HEIGHT
                - (yMargin + (int) (((float) i / verticalMaxValue) * (IMAGE_HEIGHT - 2 * yMargin)));
        g.fillRect(45, yPos, 15, 3);
        g.setFont(new Font("courier", 1, 30));
        String value = String.valueOf(i);
        if (value.length() == 1) {
            value = " " + value;
        }
        g.drawString(value, 5, yPos + 10);
    }

    // --draw x axis scale
    // ----Calculates interval between labels in x axis
    int xInterval = 1;
    int horizontalMaxValue = (int) maxExpectedLogValue + 1;

    if (horizontalMaxValue > 20) {
        xInterval = 5;
    }
    if (horizontalMaxValue > 100) {
        xInterval = 50;
    }
    if (horizontalMaxValue > 1000) {
        xInterval = verticalMaxValue;
    }

    g.setColor(Color.BLACK);
    for (int i = 0; i <= horizontalMaxValue; i = i + xInterval) {
        int xPos = (xMargin + (int) (((float) i / horizontalMaxValue) * (IMAGE_WIDTH - 2 * xMargin)));
        g.fillRect(xPos, IMAGE_HEIGHT - yMargin, 3, 15);
        g.setFont(new Font("courier", 1, 30));
        String value = String.valueOf(i);
        if (value.length() == 1) {
            value = " " + value;
        }
        g.drawString(value, xPos - 15, IMAGE_HEIGHT - yMargin + 45);
    }

    // Draws identity line
    g.setColor(Color.RED);
    int endLineValue = horizontalMaxValue < verticalMaxValue ? horizontalMaxValue : verticalMaxValue;
    g.drawLine(xMargin, IMAGE_HEIGHT - yMargin, xMargin + ((int) (endLineValue * xIncrement)),
            IMAGE_HEIGHT - (yMargin + ((int) (endLineValue * yIncrement))));

    // -- title
    g.setColor(Color.blue);
    g.setFont(new Font("arial", 1, 35));
    g.drawString(label, IMAGE_WIDTH / 7, 40);
}

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

/**
 * Creates a chart.//ww w . ja v a 2  s  .  c o  m
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final XYDataset dataset) {

    final JFreeChart chart = ChartFactory.createTimeSeriesChart("Weekly Data", "Date", "Value", dataset, true,
            true, false);

    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend sl = (StandardLegend) chart.getLegend();
    //      sl.setDisplaySeriesShapes(true);

    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    final XYItemRenderer renderer = plot.getRenderer();
    if (renderer instanceof StandardXYItemRenderer) {
        final StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
        rr.setPlotShapes(true);
        rr.setShapesFilled(true);
    }

    final DateAxis axis = (DateAxis) plot.getDomainAxis();
    final TickUnits standardUnits = new TickUnits();
    standardUnits.add(new DateTickUnit(DateTickUnit.DAY, 1, new SimpleDateFormat("MMM dd ''yy")));
    standardUnits.add(new DateTickUnit(DateTickUnit.DAY, 7, new SimpleDateFormat("MMM dd ''yy")));
    standardUnits.add(new DateTickUnit(DateTickUnit.MONTH, 1, new SimpleDateFormat("MMM ''yy")));
    axis.setStandardTickUnits(standardUnits);

    return chart;

}

From source file:grafici.FattureTimeSeriesChart.java

/**
 * Creates a chart.//  w  ww . ja v  a2  s .c o  m
 * 
 * @param dataset
 *            a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(titolo, // title
            "Date", // x-axis label
            "Quantit", // 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.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

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

    return chart;

}

From source file:grafici.MediciTimeSeriesChart.java

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

    JFreeChart chart = ChartFactory.createTimeSeriesChart(titolo, // title
            "Date", // x-axis label
            "Occorrenze", // 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.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

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

    return chart;

}

From source file:com.orange.atk.atkUI.coregui.StatisticTool.java

/**
 * Creates the chart.//  ww  w . j av a 2 s .  c o  m
 * 
 * @param piedataset
 *            the data set
 * @return the created chart
 */
private JFreeChart createChart(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart3D("", piedataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.lightGray);
    PiePlot pie3dplot = (PiePlot) jfreechart.getPlot();
    pie3dplot.setStartAngle(0);
    pie3dplot.setDirection(Rotation.CLOCKWISE);
    pie3dplot.setForegroundAlpha(0.5F);
    pie3dplot.setNoDataMessage("No data to display");
    pie3dplot.setSectionPaint(0, Color.GREEN);// passed
    pie3dplot.setSectionPaint(1, Color.RED);// failed
    pie3dplot.setSectionPaint(2, Color.ORANGE);// skipped
    pie3dplot.setSectionPaint(3, Color.LIGHT_GRAY);// not analysed
    pie3dplot.setToolTipGenerator(new MyToolTipGenerator());
    pie3dplot.setLabelGenerator(new MySectionLabelGenerator());
    pie3dplot.setLegendLabelGenerator(new MySectionLabelGenerator());
    return jfreechart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.WaterfallChartDemo1.java

/**
 * Returns the chart.//from   ww w.  j a  va  2  s  . co  m
 * 
 * @param dataset  the dataset.
 *
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createWaterfallChart(chartTitle, domainLabel, rangeLabel, dataset,
            PlotOrientation.VERTICAL, !legendPanelOn, true, false);
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    ValueAxis rangeAxis = plot.getRangeAxis();

    // create a custom tick unit collection...
    DecimalFormat formatter = new DecimalFormat("##,###");
    formatter.setNegativePrefix("(");
    formatter.setNegativeSuffix(")");
    TickUnits standardUnits = new TickUnits();
    standardUnits.add(new NumberTickUnit(5, formatter));
    standardUnits.add(new NumberTickUnit(10, formatter));
    standardUnits.add(new NumberTickUnit(20, formatter));
    standardUnits.add(new NumberTickUnit(50, formatter));
    standardUnits.add(new NumberTickUnit(100, formatter));
    standardUnits.add(new NumberTickUnit(200, formatter));
    standardUnits.add(new NumberTickUnit(500, formatter));
    standardUnits.add(new NumberTickUnit(1000, formatter));
    standardUnits.add(new NumberTickUnit(2000, formatter));
    standardUnits.add(new NumberTickUnit(5000, formatter));
    rangeAxis.setStandardTickUnits(standardUnits);

    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    DecimalFormat labelFormatter = new DecimalFormat("$##,###.00");
    labelFormatter.setNegativePrefix("(");
    labelFormatter.setNegativeSuffix(")");
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", labelFormatter));
    renderer.setBaseItemLabelsVisible(true);

    setCategorySummary(dataset);
    return chart;
}