private void configureRenderer(CategoryPlot plot) { BarRenderer renderer = new BarRenderer(); renderer.setDrawBarOutline(true); renderer.setSeriesItemLabelsVisible(0, true); renderer.setItemMargin(0); plot.setRenderer(renderer); }
static private final void setBarTheme(final JFreeChart chart) { CategoryPlot plot = (CategoryPlot) chart.getPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.lightGray); renderer.setShadowVisible(false); renderer.setDrawBarOutline(true); setBackgroundDefault(chart); }
renderer.setDrawBarOutline(false); renderer.setMaximumBarWidth(0.10);
renderer.setDrawBarOutline(false);
renderer.setDrawBarOutline(false);
private static void formatBars(JFreeChart chart) { if (chart != null) { Plot p = chart.getPlot(); if (p instanceof CategoryPlot) { CategoryPlot cp = (CategoryPlot) p; CategoryItemRenderer cir = cp.getRenderer(); if (cir instanceof BarRenderer) { BarRenderer br = (BarRenderer) cir; br.setShadowVisible(false); br.setBarPainter(new StandardBarPainter()); br.setDrawBarOutline(true); } } } }
private void plot() { CategoryPlot plot = chart.getCategoryPlot(); // plot.setDomainGridlinesVisible(true); // plot.setRangeCrosshairVisible(true); // plot.setRangeCrosshairPaint(Color.blue); plot.setRangeGridlinePaint(Color.BLACK); // set the range axis to display integers only... // NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis(); // domainAxis.setTickMarkPaint(Color.BLACK); plot.setBackgroundPaint(new Color(230,230,230)); // disable bar outlines... BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); renderer.setBaseOutlinePaint(Color.BLACK); // renderer.setBaseOutlineStroke(new BasicStroke(2)); // CategoryAxis domainAxis = plot.getDomainAxis(); // domainAxis.setCategoryLabelPositions( // CategoryLabelPositions.createUpRotationLabelPositions( // Math.PI / 6.0)); }
renderer.setDrawBarOutline(false);
renderer.setSeriesPaint(0, new Color(231, 175, 61)); renderer.setSeriesPaint(1, Color.green); renderer.setDrawBarOutline(false); renderer.setShadowVisible(false); chart.setBackgroundPaint(Color.WHITE);
renderer.setDrawBarOutline(false); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(
renderer.setDrawBarOutline(true);
public static JFreeChart doCreateSummarizerChart(CategoryDataset dataset, String yAxis, String chartTitle) { final JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart // title null, // unused yAxis, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips true // urls ); chart.setBackgroundPaint(Color.WHITE); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.BLACK); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBaseStroke(new BasicStroke(4.0f)); renderer.setItemMargin(0); renderer.setMaximumBarWidth(0.05); return chart; }
barrenderer.setDrawBarOutline(true); if(smallFontInDomainAxis && !canUseNormalFontSize(width)) barrenderer.setItemMargin(0.05);
/** * Utility method to set the default style of the Bar Charts * * @param chart {@link JFreeChart} to style */ private static void setBarChartDefaults(JFreeChart chart) { ChartUtil.setDefaults(chart); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setAxisOffset(new RectangleInsets(1.0, 1.0, 1.0, 1.0)); // renderer BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setBaseItemLabelFont(ChartDefaults.defaultFont); renderer.setBaseItemLabelsVisible(false); renderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER)); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelPaint(ChartDefaults.axisLabelColor); StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator("{1}, {2}", NumberFormat.getInstance()); renderer.setBaseToolTipGenerator(generator); renderer.setDrawBarOutline(false); renderer.setMaximumBarWidth(0.1); renderer.setItemMargin(0.02f); for (int j = 0; j < ChartDefaults.darkColors.length; j++) { renderer.setSeriesPaint(j, ChartDefaults.darkColors[j]); } }
new StandardCategoryToolTipGenerator("{1}, {2}", NumberFormat.getInstance()); renderer.setBaseToolTipGenerator(generator); renderer.setDrawBarOutline(false); for (int j = 0; j < ChartDefaults.darkColors.length; j++)
BarRenderer barRenderer = (BarRenderer)renderer; barRenderer.setDrawBarOutline(true); barRenderer.setShadowVisible(false); barRenderer.setBarPainter(new StandardBarPainter());