List of usage examples for java.awt Color lightGray
Color lightGray
To view the source code for java.awt Color lightGray.
Click Source Link
From source file:org.jfree.chart.demo.LineChartDemo7.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createLineChart("Line Chart Demo 7", "Category", "Count", categorydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setRangeGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer lineandshaperenderer = (LineAndShapeRenderer) categoryplot.getRenderer(); lineandshaperenderer.setSeriesShapesVisible(0, true); lineandshaperenderer.setSeriesShapesVisible(1, false); lineandshaperenderer.setSeriesShapesVisible(2, true); lineandshaperenderer.setSeriesLinesVisible(2, false); lineandshaperenderer.setSeriesShape(2, ShapeUtilities.createDiamond(4F)); lineandshaperenderer.setDrawOutlines(true); lineandshaperenderer.setUseFillPaint(true); lineandshaperenderer.setBaseFillPaint(Color.white); return jfreechart; }
From source file:org.jfree.chart.demo.BoxAndWhiskerChartDemo2.java
private static JFreeChart createChart(BoxAndWhiskerXYDataset boxandwhiskerxydataset) { DateAxis dateaxis = new DateAxis("Day"); NumberAxis numberaxis = new NumberAxis("Value"); XYBoxAndWhiskerRenderer xyboxandwhiskerrenderer = new XYBoxAndWhiskerRenderer(); XYPlot xyplot = new XYPlot(boxandwhiskerxydataset, dateaxis, numberaxis, xyboxandwhiskerrenderer); xyplot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart jfreechart = new JFreeChart("Box-and-Whisker Chart Demo 2", xyplot); jfreechart.setBackgroundPaint(Color.white); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setDomainGridlinesVisible(true); xyplot.setRangeGridlinePaint(Color.white); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:org.jfree.chart.demo.BarChartDemo10.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Bar Chart Demo", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setDomainGridlinePaint(Color.white); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangeGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64)); GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0)); GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0)); barrenderer.setSeriesPaint(0, gradientpaint); barrenderer.setSeriesPaint(1, gradientpaint1); barrenderer.setSeriesPaint(2, gradientpaint2); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D)); return jfreechart; }
From source file:utils.Graficos_old.java
public static JFreeChart GraficoLinhas(List<CarCapContas> pagar, List<CarCapContas> receber, String titulo) { XYSeries series1 = new XYSeries("Pagar"); // CarCapContas contasPagar = new CarCapContas(); for (CarCapContas contasPagar : pagar) { series1.add(contasPagar.getContaValorTotal(), contasPagar.getContaDataEmissao().getMonth()); }/* w w w . j a v a 2 s .c om*/ XYSeries series2 = new XYSeries("Receber"); for (CarCapContas contasReceber : receber) { series2.add(contasReceber.getContaValorTotal(), contasReceber.getContaDataEmissao().getMonth()); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); dataset.addSeries(series2); JFreeChart chart = ChartFactory.createXYLineChart(titulo, // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.jfree.chart.demo.ScatterRendererDemo1.java
private static JFreeChart createChart(MultiValueCategoryDataset multivaluecategorydataset) { CategoryPlot categoryplot = new CategoryPlot(multivaluecategorydataset, new CategoryAxis("Category"), new NumberAxis("Value"), new ScatterRenderer()); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setDomainGridlinePaint(Color.white); categoryplot.setRangeGridlinePaint(Color.white); categoryplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D)); JFreeChart jfreechart = new JFreeChart("ScatterRendererDemo1", categoryplot); ChartUtilities.applyCurrentTheme(jfreechart); return jfreechart; }
From source file:bullioneconomy.bullionchart.java
/** * Creates a chart./*from w ww . j a va 2 s .c o m*/ * * @param dataset a dataset. * * @return A chart. */ private static JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart("Gold Price in Recent Years", // title "Date", // x-axis label "Price Per 10g", // 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:updatePledge.java
/** * Creates new form updatePledge/*from www.j a v a 2 s . co m*/ */ public updatePledge() throws IOException { initComponents(); //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jTextField1.setColumns(8); jTextField2.setColumns(8); jTextField1.setText("MM/DD/YYYY"); jTextField2.setText("MM/DD/YYYY"); jComboBox1.removeAllItems(); jComboBox1.addItem("Item 1"); jComboBox2.removeAllItems(); jComboBox2.addItem("Item 1"); jComboBox2.setBackground(Color.lightGray); jComboBox2.setEditable(false); jComboBox2.setEnabled(false); jComboBox4.setBackground(Color.lightGray); jComboBox4.setEditable(false); jComboBox4.setEnabled(false); //Getting Donor Names and ID's try { try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); } catch (ClassNotFoundException ex) { Logger.getLogger(viewDonors.class.getName()).log(Level.SEVERE, null, ex); } Connection con; con = DriverManager.getConnection(DBcon.Connect(), DBcon.Login(), DBcon.Pass()); //(file path, db login, db password) - since it doesnt have a login, leave it blank Statement s = con.createStatement(); System.out.println("Connection to DB established..."); ResultSet rs = s.executeQuery("SELECT Fname, Minit, Lname, " + "DonorID FROM Individual"); System.out.println("Is connection closed: " + con.isClosed()); System.out.println("Connection to DB established..."); while (rs.next()) { //Fname, Minit, Lname System.out.print(rs.getString(1) + " "); jComboBox1.addItem(rs.getString(1) + ", " + rs.getString(2) + " " + rs.getString(3)); System.out.print(rs.getString(4)); jComboBox2.addItem(rs.getString(4)); } con.close(); System.out.println("Is connection closed: " + con.isClosed()); } catch (SQLException ex) { Logger.getLogger(userLogin.class.getName()).log(Level.SEVERE, null, ex); } jComboBox5.removeAllItems(); jComboBox5.addItem("Item 1"); jComboBox5.addItem("Weekly"); jComboBox5.addItem("Biweekly"); jComboBox5.addItem("Monthly"); }
From source file:grisu.frontend.view.swing.files.preview.fileViewers.JobStatusGridFileViewer.java
private static ChartPanel createChart(String title, String y_axis, XYDataset dataset, boolean createLegend) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title "Date", // x-axis label y_axis, // y-axis label dataset, // data createLegend, // create legend? true, // generate tooltips? false // generate URLs? );//from w w w . j a v a 2s .c o m chart.setBackgroundPaint(Color.white); final 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); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); final XYItemRenderer r = plot.getRenderer(); if (r instanceof XYLineAndShapeRenderer) { final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r; renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setDrawSeriesLineAsPath(true); } final DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd.MM. HH:mm")); return new ChartPanel(chart); }
From source file:com.kurvlrgui.gui.ChartPanel.java
/** * Creates new form ChartPanel/*from w w w.ja v a 2s. co m*/ */ public ChartPanel(String title, NumericData s1, NumericData s2) { initComponents(); calculated = new XYSeries("Calculated"); for (NumericPair np : s1.values) { calculated.add(np.x, np.y); } observed = null; if (s2 != null) { observed = new XYSeries("Observed"); for (NumericPair np : s2.values) { observed.add(np.x, np.y); } } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(calculated); if (s2 != null) dataset.addSeries(observed); JFreeChart chart = ChartFactory.createXYLineChart(title, "X", "Y", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesLinesVisible(1, false); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); panel = new org.jfree.chart.ChartPanel(chart); panel.setHorizontalAxisTrace(true); panel.setVerticalAxisTrace(true); this.add(panel); }
From source file:compecon.dashboard.panel.AgentsPanel.java
public AgentsPanel() { this.setLayout(new BorderLayout()); JTabbedPane jTabbedPane = new JTabbedPane(); for (Currency currency : Currency.values()) { JPanel panelForCurrency = new JPanel(); panelForCurrency.setLayout(new GridLayout(0, 2)); jTabbedPane.addTab(currency.getIso4217Code(), panelForCurrency); panelForCurrency.setBackground(Color.lightGray); for (Class<? extends Agent> agentType : ApplicationContext.getInstance().getAgentFactory() .getAgentTypes()) {//from w w w . j a va2 s.c o m panelForCurrency.add(createAgentNumberPanel(currency, agentType)); } } add(jTabbedPane, BorderLayout.CENTER); }