List of usage examples for java.awt Color Color
public Color(ColorSpace cspace, float[] components, float alpha)
From source file:jmbench.plots.SummaryWhiskerPlot.java
public JFreeChart createChart() { JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(title, "Matrix Libraries", "Relative Performance", dataSet, true);//from w ww. j av a 2s . c om CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); plot.setBackgroundPaint(new Color(230, 230, 230)); plot.setDomainGridlinePaint(new Color(50, 50, 50, 50)); plot.setDomainGridlineStroke(new BasicStroke(78f)); chart.getTitle().setFont(new Font("Times New Roman", Font.BOLD, 24)); String foo = "( Higher is Better )"; if (subtitle != null) foo += " ( " + subtitle + " )"; chart.addSubtitle(new TextTitle(foo, new Font("SansSerif", Font.ITALIC, 12))); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:agendapoo.View.FrmMinhaAtividade.java
public FrmMinhaAtividade(Atividade a, FrmUsuario janela) { initComponents();//from w ww . j a va2 s. co m setFrameIcon(); colorGreen = new Color(121, 175, 108); colorRed = new Color(185, 108, 108); colorBlue = new Color(97, 128, 176); this.selectedAtividade = a; loadAtividadeDescricao(); loadSelectedAtividade(selectedAtividade); this.usuarioMain = janela; }
From source file:com.jtk.pengelolaanujian.view.dashboard.PiePanelSoal.java
private ChartPanel createChart(PieDataset data) { piechart = ChartFactory.createPieChart("Soal Upload", data, true, true, false); PiePlot plot = (PiePlot) piechart.getPlot(); plot.setSectionPaint("Belum Di Print", new Color(135, 206, 250)); plot.setSectionPaint("Sudah Di Print", new Color(205, 133, 63)); plot.setNoDataMessage("Data Tidak Ada"); plot.setExplodePercent("data", 0.1D); plot.setLabelBackgroundPaint(new Color(255, 228, 225)); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator()); // Key = 0 ----> section as String (Windows, Linux, Lainnya) // Key = 1 ----> section as value (300,200,100) // KEy - 2 ----> section as percentage (50%,33%,17 %) Muncul jika aplikasi telah di running plot.setSimpleLabels(true);//from w ww. j a va2 s . c o m plot.setInteriorGap(0.0D); return new ChartPanel(piechart); }
From source file:org.jfree.chart.demo.BarChartDemo11.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Open Source Projects By Licence", "Licence", "Project Count", categorydataset, PlotOrientation.HORIZONTAL, false, 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); categoryplot.getDomainAxis().setMaximumCategoryLabelWidthRatio(0.4F); 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)); barrenderer.setSeriesPaint(0, gradientpaint); return jfreechart; }
From source file:com.gargoylesoftware.htmlunit.javascript.host.canvas.rendering.AwtRenderingBackend.java
/** * {@inheritDoc}//from w w w. j a v a 2s.c o m */ public void setFillStyle(final String fillStyle) { final String tmpFillStyle = fillStyle.replaceAll("\\s", ""); Color color = null; if (tmpFillStyle.startsWith("rgb(")) { final String[] colors = tmpFillStyle.substring(4, tmpFillStyle.length() - 1).split(","); color = new Color(Integer.parseInt(colors[0]), Integer.parseInt(colors[1]), Integer.parseInt(colors[2])); } else if (tmpFillStyle.startsWith("rgba(")) { final String[] colors = tmpFillStyle.substring(5, tmpFillStyle.length() - 1).split(","); color = new Color(Integer.parseInt(colors[0]), Integer.parseInt(colors[1]), Integer.parseInt(colors[2]), (int) (Float.parseFloat(colors[3]) * 255)); } else if (tmpFillStyle.startsWith("#")) { color = Color.decode(tmpFillStyle); } else { try { final Field f = Color.class.getField(tmpFillStyle); color = (Color) f.get(null); } catch (final Exception e) { LOG.info("Can not find color '" + tmpFillStyle + '\''); color = Color.black; } } graphics2D_.setColor(color); }
From source file:org.jfree.chart.demo.AxisOffsetsDemo1.java
private static JFreeChart createChart(String s, CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart(s, "Category", "Value", categorydataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); 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); return jfreechart; }
From source file:Reportes.BarChart.java
public ChartPanel reporteAportesVentas(DefaultCategoryDataset data) { JFreeChart chart = ChartFactory.createBarChart("Reporte de aporte por sede", "Sedes", "Aporte", data, PlotOrientation.VERTICAL, true, true, true); CategoryPlot categoryP = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) categoryP.getRenderer(); renderer.setMaximumBarWidth(0.35);// w w w . ja v a2 s.c om Color color = new Color(67, 165, 208); renderer.setSeriesPaint(0, color); ChartPanel panel = new ChartPanel(chart, true, true, true, false, false); panel.setSize(ancho, alto); return panel; }
From source file:GrayModel.java
public Color getColor() { int intValue = getIntValue(); return new Color(intValue, intValue, intValue); }
From source file:ch.unibe.iam.scg.archie.ui.charts.PatientsChart.java
/** * (non-Javadoc)/* ww w. j a va2 s.c o m*/ * * @see ch.unibe.iam.scg.archie.ui.charts.AbstractChartComposite# * initializeChart() */ @Override protected JFreeChart initializeChart() { // create a chart... JFreeChart chart = ChartFactory.createPieChart(PatientsChart.CHART_TITLE, (DefaultPieDataset) this.creator.getDataset(), true, // legend? true, // tooltips? false // URLs? ); // Set chart background color to it's parents background chart.setBackgroundPaint(new Color(this.parent.getBackground().getRed(), this.parent.getBackground().getGreen(), this.parent.getBackground().getBlue())); return chart; }
From source file:com.orsonpdf.demo.PDFPieChartDemo1.java
/** * Creates a chart.//from www .j ava2 s.c o m * * @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; }