List of usage examples for org.jfree.chart.renderer.category StandardBarPainter StandardBarPainter
public StandardBarPainter()
From source file:com.uttesh.pdfngreport.util.chart.ChartStyle.java
/** * this method will set the style theme for pie chart. * * @see org.jfree.chart.StandardChartTheme * @param chart//from w w w. j av a2s. c o m */ public static void theme(JFreeChart chart) { String fontName = "Lucida Sans"; StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setTitlePaint(Color.decode("#4572a7")); theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 16)); //title theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title theme.setRegularFont(new Font(fontName, Font.PLAIN, 11)); theme.setRangeGridlinePaint(Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setGridBandPaint(Color.red); theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint(Color.decode("#666666")); theme.apply(chart); chart.setTextAntiAlias(true); chart.setAntiAlias(true); }
From source file:OAT.ui.util.BasicBarRenderer.java
public BasicBarRenderer() { setDefaultBarPainter(new StandardBarPainter()); setShadowVisible(false); }
From source file:graficos.GenerarGraficoInventario.java
public void crear() { try {//from www.jav a 2s. c o m Dba db = new Dba(pathdb); db.conectar(); String sql = "select Nombre, CantidadDisponibles, CantidadEnUso from Activos"; db.prepare(sql); db.query.execute(); ResultSet rs = db.query.getResultSet(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rs.next()) { int total = rs.getInt(2) + rs.getInt(3); dataset.setValue(total, "Cantidad", rs.getString(1)); } JFreeChart chart = ChartFactory.createBarChart3D("Inventario de Activos del Hotel", "Activo", "Cantidad", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); // Get the Plot object for a bar graph p.setBackgroundPaint(Color.black); ((BarRenderer) p.getRenderer()).setBarPainter(new StandardBarPainter()); BarRenderer r = (BarRenderer) chart.getCategoryPlot().getRenderer(); r.setSeriesPaint(0, Color.BLUE); try { ChartUtilities.saveChartAsJPEG(new File(path), chart, 500, 300); } catch (Exception ee) { System.err.println(ee.toString()); System.err.println("Problem occurred creating chart."); } db.desconectar(); } catch (Exception e) { } }
From source file:Visuals.AreaChart.java
public ChartPanel drawAreaChart() { DefaultCategoryDataset areadataset = new DefaultCategoryDataset(); areadataset.addValue(new Double(successCount), "Success", "Success (" + successCount + ")"); areadataset.addValue(new Double(failCount), "Fail", "Fail (" + failCount + ")"); JFreeChart areachart = ChartFactory.createBarChart("", // Title "Result", "Attempts", areadataset // Dataset );/*from w ww . ja v a 2 s . co m*/ final CategoryPlot plot = areachart.getCategoryPlot(); CategoryItemRenderer renderer = new CustomRendererAudit(); areachart.removeLegend(); plot.setRenderer(renderer); areachart.getCategoryPlot().setRenderer(renderer); // plot.set("Success", new Color(230, 27, 27)); // plot.setSectionPaint("Fail", new Color(230, 90, 27)); final CategoryPlot plotx = areachart.getCategoryPlot(); ((BarRenderer) plotx.getRenderer()).setBarPainter(new StandardBarPainter()); plotx.setBackgroundPaint(new Color(210, 234, 243)); ChartPanel chartPanel = new ChartPanel(areachart); return chartPanel; }
From source file:de.tuberlin.dima.flinkhandson.utils.SingleSeriesBarChart.java
public SingleSeriesBarChart(String title, String xLabel, String yLabel, Color barColor, Map<String, Double> result) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Map.Entry<String, Double> e : result.entrySet()) { dataset.addValue(e.getValue(), "", e.getKey()); }/* w w w . j a v a2s . c o m*/ JFreeChart chart = ChartFactory.createBarChart(title, xLabel, yLabel, dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); plot.setBackgroundPaint(Color.WHITE); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setBarPainter(new StandardBarPainter()); renderer.setSeriesPaint(0, barColor); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(1024, 768)); getContentPane().add(chartPanel); pack(); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:com.awesheet.models.charts.BarChart.java
@Override public boolean generateImageData() { // Create the dataset. DefaultCategoryDataset dataset = createDataset(); if (dataset == null) { return false; }//from ww w . ja va2 s . c o m // Create the chart. JFreeChart barChart = ChartFactory.createBarChart(title, nameX, nameY, dataset, PlotOrientation.VERTICAL, true, true, false); final CategoryPlot plot = barChart.getCategoryPlot(); ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); // Generate the image. try { imageData = ChartUtilities.encodeAsPNG(barChart.createBufferedImage(720, 480)); } catch (IOException e) { return false; } return true; }
From source file:de.fub.maps.project.detector.model.statistics.BarChartPanel.java
/** * Creates new form StatisticSegmentLengthBarChart *//* w ww . jav a2 s. com*/ public BarChartPanel() { initComponents(); barChart = ChartFactory.createBarChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); plot = barChart.getCategoryPlot(); BarRenderer barRenderer = new BarRenderer(); barRenderer.setMaximumBarWidth(.05); barRenderer.setBasePaint(Color.BLUE); barRenderer.setAutoPopulateSeriesPaint(false); barRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); barRenderer.setBarPainter(new StandardBarPainter()); barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, new CustomNumberFormat())); barRenderer.setBaseItemLabelsVisible(true); plot.setRenderer(barRenderer); plot.getDomainAxis().setMaximumCategoryLabelLines(3); plot.setBackgroundPaint(Color.white); barChart.setBackgroundPaint(Color.white); plot.setRangeGridlinesVisible(true); plot.getDomainAxis().setMaximumCategoryLabelLines(3); chartPanel = new ChartPanel(barChart, false); chartPanel.setVerticalAxisTrace(false); chartPanel.setDisplayToolTips(true); chartPanel.setBackground(Color.white); add(chartPanel, BorderLayout.CENTER); }
From source file:net.sf.mzmine.chartbasics.chartthemes.EStandardChartTheme.java
public EStandardChartTheme(THEME themeID, String name) { super(name);/* w w w .java2s.c o m*/ this.themeID = themeID; setBarPainter(new StandardBarPainter()); setXYBarPainter(new StandardXYBarPainter()); // in theme setAntiAliased(false); setNoBackground(false); // general isAntiAliased = true; masterFont = new Font("Arial", Font.PLAIN, 11); masterFontColor = Color.black; }
From source file:de.fub.maps.project.plugins.tasks.eval.Barchart.java
public Barchart() { setLayout(new BorderLayout()); plot = new CategoryPlot() { private static final long serialVersionUID = 1L; @Override//from www . j a va 2 s. c om public LegendItemCollection getLegendItems() { CategoryItemRenderer renderer = getRenderer(0); return renderer.getLegendItems(); } }; plot.setRangeAxis(new NumberAxis()); plot.setDomainAxis(new CategoryAxis()); plot.getDomainAxis().setMaximumCategoryLabelLines(3); plot.getDomainAxis().setCategoryLabelPositionOffset(5); plot.setDataset(dataset); plot.setOrientation(PlotOrientation.VERTICAL); chart = new JFreeChart(null, null, plot, true); chart.setBackgroundPaint(Color.white); BarRenderer renderer = new BarRenderer(); renderer.setBarPainter(new StandardBarPainter()); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); renderer.setAutoPopulateSeriesFillPaint(true); renderer.setAutoPopulateSeriesPaint(true); renderer.setShadowVisible(false); renderer.setSeriesToolTipGenerator(0, new StandardCategoryToolTipGenerator()); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.white); chartPanel = new ChartPanel(chart, false); chartPanel.setBackground(Color.white); add(chartPanel, BorderLayout.CENTER); }
From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputHistogram.java
public static void enableFlatLook(final boolean flat) { if (flat) {/* w w w .j a v a2 s.c om*/ BarRenderer.setDefaultBarPainter(new StandardBarPainter()); BarRenderer.setDefaultShadowsVisible(false); XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter()); XYBarRenderer.setDefaultShadowsVisible(false); StackedBarRenderer.setDefaultBarPainter(new StandardBarPainter()); StackedBarRenderer.setDefaultShadowsVisible(false); } else { BarRenderer.setDefaultBarPainter(new GradientBarPainter()); BarRenderer.setDefaultShadowsVisible(true); XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter()); XYBarRenderer.setDefaultShadowsVisible(true); StackedBarRenderer.setDefaultBarPainter(new GradientBarPainter()); StackedBarRenderer.setDefaultShadowsVisible(true); } }