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:ch.unibe.iam.scg.archie.ui.charts.ConsultationNumberChart.java
/** * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite# * initializeChart()// w ww . j a va 2 s . co m */ @Override protected JFreeChart initializeChart() { JFreeChart chart = ChartFactory.createTimeSeriesChart(ConsultationNumberChart.CHART_TITLE, // title "", // x-axis label "Count", // y-axis label (XYDataset) this.creator.getDataset(), // data false, // create legend? true, // generate tooltips? false // generate URLs? ); chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); 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.wattzap.view.graphs.GenericScatterGraph.java
public GenericScatterGraph(XYSeries series, String xAxis, String yAxis) { super();/*from ww w . j a v a 2 s. c om*/ XYDataset xyDataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createScatterPlot("", // chart title xAxis, // x axis label yAxis, // y axis label null, PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.darkGray); plot = chart.getXYPlot(); plot.setDataset(0, xyDataset); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); // Shape cross = ShapeUtilities.createDiamond(0.5f); Shape cross = ShapeUtilities.createDiagonalCross(0.5f, 0.5f); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, new Color(252, 141, 89)); renderer.setSeriesShape(0, cross); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelPaint(Color.white); domainAxis.setLabelPaint(Color.white); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickLabelPaint(Color.white); rangeAxis.setLabelPaint(Color.white); chartPanel = new ChartPanel(chart); chartPanel.setSize(100, 800); setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); setBackground(Color.black); chartPanel.revalidate(); setVisible(true); }
From source file:org.jfree.chart.demo.StackedXYBarChartDemo3.java
private static JFreeChart createChart(TableXYDataset tablexydataset) { DateAxis dateaxis = new DateAxis("Year"); dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateaxis.setLowerMargin(0.01D);// ww w . java2 s. c o m dateaxis.setUpperMargin(0.01D); NumberAxis numberaxis = new NumberAxis("Tonnes"); numberaxis.setNumberFormatOverride(new DecimalFormat("0.0%")); StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.29999999999999999D); stackedxybarrenderer.setRenderAsPercentages(true); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, new Color(64, 0, 0), 0.0F, 0.0F, Color.red); GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, new Color(0, 64, 0), 0.0F, 0.0F, Color.green); stackedxybarrenderer.setSeriesPaint(0, gradientpaint); stackedxybarrenderer.setSeriesPaint(1, gradientpaint1); stackedxybarrenderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); stackedxybarrenderer.setDrawBarOutline(false); stackedxybarrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2} tonnes", new SimpleDateFormat("yyyy"), new DecimalFormat("#,##0"))); XYPlot xyplot = new XYPlot(tablexydataset, dateaxis, numberaxis, stackedxybarrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); JFreeChart jfreechart = new JFreeChart("Waste Management", xyplot); jfreechart.setBackgroundPaint(Color.white); jfreechart.addSubtitle(new TextTitle("St Albans City and District Council")); return jfreechart; }
From source file:de.quadrillenschule.azocamsyncd.gui.ConfigurationWizardJFrame.java
public void updateSelectedPanel(int i) { String resource = "/de/quadrillenschule/azocamsyncd/ftpservice/res/step" + i + ".html"; selectedPanel = i;// w w w . j av a 2 s . c om for (JPanel j : stepPanels) { j.setEnabled(false); j.setBackground(Color.lightGray); } stepPanels.get(i).setEnabled(true); stepPanels.get(i).setBackground(Color.white); showDocument(resource); }
From source file:ShowOff.java
protected void drawBackground(Graphics2D g2) { int side = 45; int width = getSize().width; int height = getSize().height; Color[] colors = { Color.yellow, Color.cyan, Color.orange, Color.pink, Color.magenta, Color.lightGray }; for (int y = 0; y < height; y += side) { for (int x = 0; x < width; x += side) { Ellipse2D ellipse = new Ellipse2D.Float(x, y, side, side); int index = (x + y) / side % colors.length; g2.setPaint(colors[index]);/*from ww w.j a va 2s . co m*/ g2.fill(ellipse); } } }
From source file:org.jfree.chart.swt.demo.SWTMultipleAxisDemo1.java
/** * Creates the demo chart./*from www . j a v a2 s. co m*/ * * @return The chart. */ private static JFreeChart createChart() { XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200); JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day", "Primary Range Axis", dataset1, true, true, false); chart.setBackgroundPaint(Color.white); chart.setBorderVisible(true); chart.setBorderPaint(Color.BLACK); TextTitle subtitle = new TextTitle("Four datasets and four range axes."); chart.addSubtitle(subtitle); XYPlot plot = (XYPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.black); // AXIS 2 NumberAxis axis2 = new NumberAxis("Range Axis 2"); axis2.setAutoRangeIncludesZero(false); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); XYDataset dataset2 = createDataset("Series 2", 1000.0, new Minute(), 170); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); XYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // AXIS 3 NumberAxis axis3 = new NumberAxis("Range Axis 3"); axis3.setLabelPaint(Color.blue); axis3.setTickLabelPaint(Color.blue); //axis3.setPositiveArrowVisible(true); plot.setRangeAxis(2, axis3); XYDataset dataset3 = createDataset("Series 3", 10000.0, new Minute(), 170); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 2); XYItemRenderer renderer3 = new StandardXYItemRenderer(); renderer3.setSeriesPaint(0, Color.blue); plot.setRenderer(2, renderer3); // AXIS 4 NumberAxis axis4 = new NumberAxis("Range Axis 4"); axis4.setLabelPaint(Color.green); axis4.setTickLabelPaint(Color.green); plot.setRangeAxis(3, axis4); XYDataset dataset4 = createDataset("Series 4", 25.0, new Minute(), 200); plot.setDataset(3, dataset4); plot.mapDatasetToRangeAxis(3, 3); XYItemRenderer renderer4 = new StandardXYItemRenderer(); renderer4.setSeriesPaint(0, Color.green); plot.setRenderer(3, renderer4); return chart; }
From source file:cn.edu.thss.iise.bpmdemo.charts.SWTMultipleAxisDemo1.java
/** * Creates the demo chart.//from w w w. j a va 2s.com * * @return The chart. */ private static JFreeChart createChart() { XYDataset dataset1 = createDataset("Series 1", 100.0, new Day(), 200); JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day", "Primary Range Axis", dataset1, true, true, false); chart.setBackgroundPaint(Color.white); chart.setBorderVisible(true); chart.setBorderPaint(Color.BLACK); TextTitle subtitle = new TextTitle("Four datasets and four range axes."); chart.addSubtitle(subtitle); XYPlot plot = (XYPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.black); // AXIS 2 NumberAxis axis2 = new NumberAxis("Range Axis 2"); axis2.setAutoRangeIncludesZero(false); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); XYDataset dataset2 = createDataset("Series 2", 1000.0, new Day(), 170); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); XYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); // AXIS 3 NumberAxis axis3 = new NumberAxis("Range Axis 3"); axis3.setLabelPaint(Color.blue); axis3.setTickLabelPaint(Color.blue); // axis3.setPositiveArrowVisible(true); plot.setRangeAxis(2, axis3); XYDataset dataset3 = createDataset("Series 3", 10000.0, new Day(), 170); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 2); XYItemRenderer renderer3 = new StandardXYItemRenderer(); renderer3.setSeriesPaint(0, Color.blue); plot.setRenderer(2, renderer3); // AXIS 4 NumberAxis axis4 = new NumberAxis("Range Axis 4"); axis4.setLabelPaint(Color.green); axis4.setTickLabelPaint(Color.green); plot.setRangeAxis(3, axis4); XYDataset dataset4 = createDataset("Series 4", 25.0, new Day(), 200); plot.setDataset(3, dataset4); plot.mapDatasetToRangeAxis(3, 3); XYItemRenderer renderer4 = new StandardXYItemRenderer(); renderer4.setSeriesPaint(0, Color.green); plot.setRenderer(3, renderer4); return chart; }
From source file:netplot.DialPlotPanel.java
public void init() { finalize();/* w w w . ja v a 2 s. c o m*/ this.dataset1 = new DefaultValueDataset(10.0); this.dataset2 = new DefaultValueDataset(50.0); // get data for diagrams plot = new DialPlot(); plot.setView(0.0, 0.0, 1.0, 1.0); plot.setDataset(0, this.dataset1); plot.setDataset(1, this.dataset2); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setBackgroundPaint(Color.lightGray); dialFrame.setForegroundPaint(Color.darkGray); plot.setDialFrame(dialFrame); GradientPaint gp = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220)); DialBackground db = new DialBackground(gp); db.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL)); plot.setBackground(db); DialCap cap = new DialCap(); cap.setRadius(0.10); plot.setCap(cap); chart = new JFreeChart(plot); ChartPanel cp1 = new ChartPanel(chart); cp1.setPreferredSize(new Dimension(400, 400)); add(cp1); }
From source file:com.waitwha.nessus.trendanalyzer.gui.TimeChartPanel.java
/** * Constructor//from w w w . java 2s.c o m * * @param title String title of the chart. * @param xaxisLabel String x-axis label of the chart. * @param yaxisLabel String y-axis label of the chart (time). * @param dataset XYDataset to use within the chart. */ public TimeChartPanel(String title, String xaxisLabel, String yaxisLabel, XYDataset dataset) { super(new BorderLayout()); JFreeChart chart = ChartFactory.createTimeSeriesChart(title, xaxisLabel, yaxisLabel, dataset, 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("yyyy-MM-dd HH:mm")); ChartPanel panel = new ChartPanel(chart); panel.setMouseWheelEnabled(true); this.add(panel, BorderLayout.CENTER); this.validate(); }
From source file:edu.psu.citeseerx.misc.charts.CiteChartBuilderJFree.java
protected JFreeChart buildChart(Document doc) throws SQLException { Long clusterid = doc.getClusterID(); if (clusterid == null) { return null; }/*from ww w . j a va 2s. co m*/ java.util.List<ThinDoc> citingDocs = citedao.getCitingDocuments(clusterid, 0, MAX_CITING); XYDataset dataset = collectData(citingDocs); if (dataset.getItemCount(0) <= 1) { return null; } XYBarDataset ivl_dataset = new XYBarDataset(dataset, 15.0); JFreeChart chart = ChartFactory.createXYBarChart(null, "Year", true, "Citation Count", ivl_dataset, PlotOrientation.VERTICAL, false, false, false); 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(); NumberAxis axis = (NumberAxis) plot.getDomainAxis(); axis.setNumberFormatOverride(NumberFormat.getIntegerInstance()); //axis.setTickUnit(new DateTickUnit(DateTickUnit.YEAR, -1)); //axis.setDateFormatOverride(new SimpleDateFormat("yyyy")); return chart; }