Example usage for java.awt Color DARK_GRAY

List of usage examples for java.awt Color DARK_GRAY

Introduction

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

Prototype

Color DARK_GRAY

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

Click Source Link

Document

The color dark gray.

Usage

From source file:netplot.TimeSeriesPlotPanel.java

private JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(plotTitle, // title
            xAxisName, // x-axis label
            yAxisName, // y-axis label
            dataset, // data
            enableLegend, // create legend?
            true, // generate tooltips?
            true // generate URLs?
    );/* w  w w .j  a  v a  2s.c  om*/

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    return chart;
}

From source file:netplot.BarPlotPanel.java

private JFreeChart createChart() {
    collection = new XYSeriesCollection();
    collection.addSeries(series);//from w w  w  .  jav a  2s  .c o  m
    dataset = new XYBarDataset(collection, 0.9);

    chart = ChartFactory.createXYBarChart(plotTitle, "", false, "", dataset, PlotOrientation.VERTICAL,
            enableLegend, true, true);

    plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(true);
    return chart;
}

From source file:GraphUI.java

/**
 * Creates new form GraphUI/* ww  w.  j a  va  2s.  c o m*/
 */
public GraphUI() {
    try {
        //graphPane is the jPanel in the jFrame
        //cp is the ChartPanel that needs to be held inside jPanel1
        initComponents();
        data = Pinwheel.getData();
        this.batch = data[0];

        //jPanel1 = createChartPanel();
        cp = createChartPanel();
        //cp = new ChartPanel(chart);
        cp.setMouseWheelEnabled(true);

        jPanel1.add(cp);

        XYPlot plot = chart.getXYPlot();

        XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();

        renderer.setSeriesStroke(0, new BasicStroke(3.0f));
        renderer.setSeriesStroke(1, new BasicStroke(3.0f));

        plot.setBackgroundPaint(Color.DARK_GRAY);

        plot.setRangeGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.BLACK);

        plot.setDomainGridlinesVisible(true);
        plot.setDomainGridlinePaint(Color.BLACK);

        plot.setRenderer(renderer);

        this.addWindowListener(new java.awt.event.WindowAdapter() {
            @Override
            public void windowClosing(java.awt.event.WindowEvent windowEvent) {
                backBtn.doClick();
            }
        });

    } catch (SQLException ex) {
        Logger.getLogger(GraphUI.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:graph.MySensorPanel.java

/**
 * Creates a new self-contained demo panel.
 *//*from  w  ww  .j a va 2s .  c o  m*/
public MySensorPanel(String header_str) {
    //super(new BorderLayout());
    this.series1 = new TimeSeries("Temperature");
    this.series2 = new TimeSeries("Humidity");
    TimeSeriesCollection dataset1 = new TimeSeriesCollection(this.series1);
    TimeSeriesCollection dataset2 = new TimeSeriesCollection(this.series2);

    JFreeChart chart = ChartFactory.createTimeSeriesChart(header_str, "Time", "C", dataset1, true, true,
            false);

    /*this.addChart(chart);*/

    XYPlot plot = (XYPlot) chart.getPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(1000.0 * 60 * 60 /* 24*/); // 24 hrs

    plot.setDataset(1, dataset2);
    NumberAxis rangeAxis2 = new NumberAxis("%");
    rangeAxis2.setAutoRangeIncludesZero(false);
    plot.setRenderer(1, new DefaultXYItemRenderer());
    plot.setRangeAxis(1, rangeAxis2);
    plot.mapDatasetToRangeAxis(1, 1);

    ChartUtilities.applyCurrentTheme(chart);
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    chartPanel = new ChartPanel(chart);
}

From source file:com.rapidminer.gui.plotter.charts.ColorizedBubbleRenderer.java

@Override
public Paint getItemOutlinePaint(int series, int item) {
    return Color.DARK_GRAY;
}

From source file:IHM.NewClass.java

/**
 *
 * @param title//from ww  w  . j  av  a  2 s . c o  m
 */
public NewClass(String title /*,*JInternalFrame jp*/) {
    super(title);
    // jp = new JInternalFrame("courbes");

    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(500, 300));
    setContentPane(panel);
    //  jp.add(panel, BorderLayout.EAST);
    //  jp.setVisible(true);
    panel.setVisible(true);
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    // sets thickness for series (using strokes)
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setRenderer(renderer);
    plot.setOutlinePaint(Color.BLUE);
    plot.setOutlineStroke(new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);

}

From source file:com.orsonpdf.demo.PDFPieChartDemo1.java

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

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", dataset, false, false,
            false);

    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);
    plot.setShadowPaint(null);
    plot.setLabelShadowPaint(null);

    // 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);
    BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 1.0f);
    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:motordrivertxrx.View.MainView.java

/**
 * Creates new form MainView//from   www .  j  av  a2  s.c o  m
 */
public MainView() {
    initComponents();

    this.dataset1 = new DefaultValueDataset(10.0);
    this.dataset2 = new DefaultValueDataset(50.0);

    // get data for diagrams
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    plot.setDataset(0, this.dataset1);
    plot.setDataset(1, this.dataset2);
    SimpleDialFrame dialFrame = new SimpleDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.DARK_GRAY);
    plot.setDialFrame(dialFrame);
    /*
    GradientPaint gp = new GradientPaint(new Point(), 
        new Color(255, 255, 255), new Point(), 
        new Color(170, 170, 220));
    */
    GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), Color.ORANGE);

    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    plot.setBackground(db);

    DialTextAnnotation annotation1 = new DialTextAnnotation("Velocidad");
    annotation1.setFont(new Font("Dialog", Font.BOLD, 14));
    annotation1.setRadius(0.7);

    plot.addLayer(annotation1);

    DialValueIndicator dvi = new DialValueIndicator(0, "c");
    dvi.setFont(new Font("Dialog", Font.PLAIN, 10));
    dvi.setOutlinePaint(Color.darkGray);
    dvi.setRadius(0.60);
    dvi.setAngle(-103.0);
    plot.addLayer(dvi);

    DialValueIndicator dvi2 = new DialValueIndicator(1, "c");
    dvi2.setFont(new Font("Dialog", Font.PLAIN, 10));
    dvi2.setOutlinePaint(Color.red);
    dvi2.setRadius(0.60);
    dvi2.setAngle(-77.0);
    plot.addLayer(dvi2);

    StandardDialScale scale = new StandardDialScale(0, 127, -120, -300);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFont(new Font("Dialog", Font.PLAIN, 14));
    plot.addScale(0, scale);

    StandardDialScale scale2 = new StandardDialScale(0, 100, -120, -300);
    scale2.setTickRadius(0.50);
    scale2.setTickLabelOffset(0.15);
    scale2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 10));
    scale2.setMajorTickPaint(Color.red);
    plot.addScale(1, scale2);
    plot.mapDatasetToScale(1, 1);

    DialPointer needle2 = new DialPointer.Pin(1);
    needle2.setRadius(0.55);
    plot.addLayer(needle2);

    DialPointer needle = new DialPointer.Pointer(0);
    plot.addLayer(needle);

    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    plot.setCap(cap);

    JFreeChart chart1 = new JFreeChart(plot);
    chart1.setTitle("Velocidad motor");
    ChartPanel cp1 = new ChartPanel(chart1);
    cp1.setPreferredSize(new Dimension(400, 400));

    /*JPanel sliderPanel = new JPanel(new GridLayout(2, 2));
    sliderPanel.add(new JLabel("Outer Needle:"));
    sliderPanel.add(new JLabel("Inner Needle:"));
    this.slider1 = new JSlider(-40, 60);
    this.slider1.setMajorTickSpacing(20);
    this.slider1.setPaintTicks(true);
    this.slider1.setPaintLabels(true);
    this.slider1.addChangeListener(this);
    sliderPanel.add(this.slider1);
    sliderPanel.add(this.slider1);
    this.slider2 = new JSlider(0, 100);
    this.slider2.setMajorTickSpacing(20);
    this.slider2.setPaintTicks(true);
    this.slider2.setPaintLabels(true);
    this.slider2.addChangeListener(this);
    sliderPanel.add(this.slider2);*/

    velocimetroPanel.add(cp1);

}

From source file:com.pureinfo.srm.common.ImageHelper.java

private static Color getColor() {
    Color[] names = new Color[] { Color.WHITE, Color.RED, Color.GREEN, Color.BLUE, Color.CYAN,
            Color.DARK_GRAY };
    return names[Math.abs(random.nextInt()) % names.length];
}

From source file:servlet.SalesReportPieChart.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods.//  w  w w  . java 2s.  c  o  m
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    DefaultPieDataset dataset = new DefaultPieDataset();
    int totalTickets = Integer.valueOf(request.getParameter("totalTickets"));
    int totalSoldTickets = Integer.valueOf(request.getParameter("totalSoldTickets"));

    dataset.setValue("Unsold Tickets", new Double(totalTickets - totalSoldTickets));
    dataset.setValue("Sold Tickets", new Double(totalSoldTickets));

    JFreeChart chart = ChartFactory.createPieChart("Ticket Sales", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionPaint("Unsold Tickets", Color.DARK_GRAY);
    plot.setSectionPaint("Sold Tickets", Color.CYAN);
    plot.setExplodePercent("Unsold Tickets", 0.10);
    plot.setSimpleLabels(true);
    plot.setBackgroundPaint(Color.WHITE);

    PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
            new DecimalFormat("0"), new DecimalFormat("0%"));
    plot.setLabelGenerator(gen);

    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());

    int width = 500; /* Width of the image */

    int height = 400; /* Height of the image */

    response.setContentType("image/png");
    OutputStream out = response.getOutputStream();

    ChartUtilities.writeChartAsPNG(out, chart, 400, 300, info);
}