List of usage examples for java.awt Color Color
public Color(float r, float g, float b, float a)
From source file:com.js.quickestquail.ui.stats.ExtensionStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.extension.title"), // chart title generateDataset(), // data true, // include legend true, false);/*ww w . j a va 2 s .c om*/ chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:de.bfs.radon.omsimulation.gui.data.OMCharts.java
/** * Creates a chart displaying the radon concentration of a single room. Uses * red for normal rooms, blue for cellar rooms and green for misc rooms. * // w w w. j a v a 2s . c o m * @param title * The headline of the chart. Will be hidden if set to null. * @param room * The room object containing the radon data. * @param preview * Will hide annotations, labels and headlines if true. * @return A chart displaying the radon concentration of a single room. */ public static JFreeChart createRoomChart(String title, OMRoom room, boolean preview) { Color lineColor = new Color(0, 0, 0, 128); Color rangeColor = new Color(222, 222, 222, 128); if (room.getType() == OMRoomType.Room) { lineColor = new Color(255, 0, 0, 128); rangeColor = new Color(255, 222, 222, 128); } else { if (room.getType() == OMRoomType.Cellar) { lineColor = new Color(0, 0, 255, 128); rangeColor = new Color(222, 222, 255, 128); } else { lineColor = new Color(0, 128, 0, 255); rangeColor = new Color(222, 255, 222, 128); } } double[] values = room.getValues(); XYSeriesCollection dataSet = new XYSeriesCollection(); XYSeries series = new XYSeries("Radon"); int count = room.getCount(); double maxPointerKey = 0; for (int i = 0; i < count; i++) { series.add(i, values[i]); if (values[i] == room.getMaximum()) { maxPointerKey = i; } } dataSet.addSeries(series); title = title + ": " + room.getType().toString() + " " + room.getId(); JFreeChart chart = ChartFactory.createXYLineChart(title, "T [h]", "Rn [Bq/m\u00B3]", dataSet, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); double positiveDeviation = room.getAverage() + room.getDeviation(); double negativeDeviation = room.getAverage() - room.getDeviation(); IntervalMarker deviation = new IntervalMarker(negativeDeviation, positiveDeviation); float[] dash = { 5, 3 }; deviation.setPaint(rangeColor); deviation.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0)); plot.addRangeMarker(deviation, Layer.BACKGROUND); ValueMarker arithMarker = new ValueMarker(room.getAverage(), lineColor, new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0)); plot.addRangeMarker(arithMarker); ValueMarker maxiMarker = new ValueMarker(room.getMaximum(), lineColor, new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dash, 0)); plot.addRangeMarker(maxiMarker); XYTextAnnotation amLabel = new XYTextAnnotation("AM=" + (int) room.getAverage(), count, room.getAverage() * 1.01); plot.addAnnotation(amLabel); XYTextAnnotation sdLabel = new XYTextAnnotation("SD=" + (int) room.getDeviation(), count, (room.getAverage() + room.getDeviation()) * 1.01); plot.addAnnotation(sdLabel); XYTextAnnotation maxLabel = new XYTextAnnotation("MAX=" + (int) room.getMaximum(), count, room.getMaximum() * 1.01); plot.addAnnotation(maxLabel); XYPointerAnnotation maxPointer = new XYPointerAnnotation("", maxPointerKey, room.getMaximum(), Math.PI * 1.1); plot.addAnnotation(maxPointer); XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, lineColor); if (preview) { chart.setTitle(""); plot.clearAnnotations(); } return chart; }
From source file:Main.java
public void repaint(BufferedImage orig, BufferedImage copy) { Graphics2D g = copy.createGraphics(); g.drawImage(orig, 0, 0, null);//w ww. jav a2 s. co m g.setColor(Color.RED); if (captureRect == null) { return; } g.draw(captureRect); g.setColor(new Color(25, 25, 23, 10)); g.fill(captureRect); g.dispose(); }
From source file:com.js.quickestquail.ui.stats.GenreStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.genre.title"), // chart title generateDataset(), // data true, // include legend true, false);/*from w w w. j a va 2 s .co m*/ chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:jamel.gui.charts.InstantScatterChart.java
/** * Creates a new instant chart.//w ww . ja va 2s . c om * * @param title the title. * @param xLabel the label of the x series. * @param yLabel the label of the y series. */ public InstantScatterChart(String title, String xLabel, String yLabel) { super(title, null, xLabel, yLabel); this.xLabel = xLabel; this.yLabel = yLabel; final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setBaseLinesVisible(false); renderer.setSeriesPaint(0, new Color(0.3f, 0.3f, 0.3f, 0.5f)); renderer.setSeriesFillPaint(0, new Color(0.3f, 0.3f, 1f, 0.5f)); renderer.setUseFillPaint(true); ((XYPlot) getPlot()).setRenderer(renderer); }
From source file:com.js.quickestquail.ui.stats.LanguageStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.language.title"), // chart title generateDataset(), // data true, // include legend true, false);/* ww w. jav a2 s . co m*/ chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:be.ugent.maf.cellmissy.gui.view.renderer.jfreechart.AngularHistogramRenderer.java
@Override public void drawSeries(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot, XYDataset dataset, int seriesIndex) { // compute the right color for the paint int length = GuiUtils.getAvailableColors().length; Color color = GuiUtils.getAvailableColors()[index % length]; // get all the data points int numPoints = dataset.getItemCount(seriesIndex); for (int i = 0; i < numPoints; i++) { double theta = dataset.getXValue(seriesIndex, i); // the angle at the center double radius = dataset.getYValue(seriesIndex, i); // the frequency Point p0 = plot.translateToJava2D(0, 0, plot.getAxis(), dataArea); Point p1 = plot.translateToJava2D(theta - binSize, radius, plot.getAxis(), dataArea); Point p2 = plot.translateToJava2D(theta + binSize, radius, plot.getAxis(), dataArea); Polygon poly = new Polygon(new int[] { p0.x, p1.x, p2.x }, new int[] { p0.y, p1.y, p2.y }, 3); g2.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 175)); g2.fill(poly);//from ww w . j a v a 2 s. c om } }
From source file:com.js.quickestquail.ui.stats.CountryStat.java
private JFreeChart generateChart() { JFreeChart chart = ChartFactory.createPieChart( java.util.ResourceBundle.getBundle("i18n/i18n").getString("stat.country.title"), // chart title generateDataset(), // data true, // include legend true, false);//ww w. ja v a 2 s . c o m chart.setBackgroundPaint(new Color(0xFF, 0xFF, 0xFF, 0)); chart.getPlot().setBackgroundPaint(Color.WHITE); return chart; }
From source file:UI.MainViewPanel.java
public ChartPanel getPanel2(Metric2 m2) { int totalRiskCount = m2.totalCriticalCount + m2.totalHighCount + m2.totalLowCount + m2.totalMediumCount; String[][] risks = new String[totalRiskCount][3]; BarChart barChart = new BarChart(m2.totalCriticalCount, m2.totalHighCount, m2.totalMediumCount, m2.totalLowCount, 0, "", risks); ChartPanel thisChart = barChart.drawBarChart(); thisChart.setBackground(Color.white); JFreeChart chart = thisChart.getChart(); chart.setBackgroundPaint(new Color(0, 0, 0, 0)); Plot plot = chart.getPlot();/*from www .jav a2s . co m*/ plot.setBackgroundPaint(chartBackgroundColor); return thisChart; }
From source file:sernet.gs.ui.rcp.main.bsi.views.chart.MaturitySpiderChart.java
protected JFreeChart createSpiderChart(Object dataset) { SpiderWebPlot plot = new SpiderWebPlot((CategoryDataset) dataset); plot.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setSeriesPaint(0, new Color(0.0f, 1f, 0f, 1f)); // green plot.setSeriesPaint(1, new Color(1f, 1f, 0f, 1f)); // yellow plot.setSeriesPaint(2, new Color(1f, 0f, 0f, 1f)); // red plot.setSeriesPaint(3, new Color(0f, 0f, 0f, 1f)); // grey plot.setWebFilled(true);/*from ww w . ja v a2s.com*/ JFreeChart chart = new JFreeChart(Messages.MaturitySpiderChart_0, TextTitle.DEFAULT_FONT, plot, false); LegendTitle legend = new LegendTitle(plot); legend.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legend); return chart; }