List of usage examples for org.jfree.chart ChartFactory createStackedBarChart3D
public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:org.jfree.chart.demo.StackedBarChart3DDemo5.java
private static JFreeChart createChart(int i, CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Chart " + (i + 1), "Category", "Value", categorydataset, PlotOrientation.VERTICAL, false, false, false); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.getDomainAxis().setMaximumCategoryLabelLines(2); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); categoryplot.setDomainGridlinePaint(Color.white); categoryplot.setRangeGridlinePaint(Color.white); ValueAxis valueaxis = categoryplot.getRangeAxis(); valueaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:sernet.gs.ui.rcp.main.bsi.views.chart.LebenszyklusBarChart.java
protected JFreeChart createBarChart(Object dataset) { final float foregroundAlpha = 0.6f; JFreeChart chart = ChartFactory.createStackedBarChart3D(null, Messages.LebenszyklusBarChart_2, Messages.LebenszyklusBarChart_3, (CategoryDataset) dataset, PlotOrientation.HORIZONTAL, false, true, false);// w ww . j a va2 s . com chart.setBackgroundPaint(Color.white); chart.getPlot().setForegroundAlpha(foregroundAlpha); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD); return chart; }
From source file:org.pentaho.plugin.jfreereport.reportcharts.BarChartExpression.java
public JFreeChart computeCategoryChart(final CategoryDataset categoryDataset) { final PlotOrientation orientation = computePlotOrientation(); final JFreeChart chart; if (isThreeD()) { if (isStacked()) { chart = ChartFactory.createStackedBarChart3D(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } else {/*from w ww . ja v a2s . com*/ chart = ChartFactory.createBarChart3D(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis3D(getCategoryAxisLabel(), getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale())); } else { if (isStacked()) { chart = ChartFactory.createStackedBarChart(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } else { chart = ChartFactory.createBarChart(computeTitle(), getCategoryAxisLabel(), getValueAxisLabel(), categoryDataset, orientation, isShowLegend(), false, false); } chart.getCategoryPlot().setDomainAxis(new FormattedCategoryAxis(getCategoryAxisLabel(), getCategoricalAxisMessageFormat(), getRuntime().getResourceBundleFactory().getLocale())); } final CategoryPlot plot = (CategoryPlot) chart.getPlot(); configureLogarithmicAxis(plot); return chart; }
From source file:org.jfree.chart.demo.StackedBarChart3DDemo.java
/** * Creates a chart.//w w w.j av a2 s . co m * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { final JFreeChart chart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.HORIZONTAL, // the plot orientation true, // include legend true, // tooltips false // urls ); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setRenderingOrder(LegendRenderingOrder.REVERSE); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); final CategoryItemRenderer renderer = plot.getRenderer(); // renderer.setLabelGenerator(new StandardCategoryLabelGenerator()); renderer.setItemLabelsVisible(true); renderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); renderer.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return chart; }
From source file:org.sonar.plugins.scmstats.charts.StackedBarChart3D.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D(null, "Authors", "Activity", categorydataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setNumberFormatOverride(new DecimalFormat("0%")); StackedBarRenderer3D stackedbarrenderer3d = (StackedBarRenderer3D) categoryplot.getRenderer(); stackedbarrenderer3d.setRenderAsPercentages(true); stackedbarrenderer3d.setDrawBarOutline(false); stackedbarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3}", NumberFormat.getIntegerInstance(), new DecimalFormat("0.0%"))); stackedbarrenderer3d.setBaseItemLabelsVisible(true); stackedbarrenderer3d/*from w ww. j ava 2 s .c o m*/ .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); stackedbarrenderer3d .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); stackedbarrenderer3d.setSeriesPaint(0, Color.decode("#66CD00")); stackedbarrenderer3d.setSeriesPaint(1, Color.decode("#4F94CD")); stackedbarrenderer3d.setSeriesPaint(2, Color.decode("#FF4040")); return jfreechart; }
From source file:biz.ixnay.pivot.charts.skin.jfree.BarChartViewSkin.java
@Override protected JFreeChart createChart() { BarChartView chartView = (BarChartView) getComponent(); String title = chartView.getTitle(); String horizontalAxisLabel = chartView.getHorizontalAxisLabel(); String verticalAxisLabel = chartView.getVerticalAxisLabel(); boolean showLegend = chartView.getShowLegend(); String seriesNameKey = chartView.getSeriesNameKey(); List<?> chartData = chartView.getChartData(); // TODO Make plot orientation a style property JFreeChart chart;//from w ww . j a v a 2 s. co m ChartView.CategorySequence categories = chartView.getCategories(); if (categories.getLength() > 0) { CategorySeriesDataset dataset = new CategorySeriesDataset(categories, seriesNameKey, chartData); if (stacked && threeDimensional) { chart = ChartFactory.createStackedBarChart3D(title, horizontalAxisLabel, verticalAxisLabel, dataset, PlotOrientation.VERTICAL, showLegend, false, false); } else if (stacked) { chart = ChartFactory.createStackedBarChart(title, horizontalAxisLabel, verticalAxisLabel, dataset, PlotOrientation.VERTICAL, showLegend, false, false); } else if (threeDimensional) { chart = ChartFactory.createBarChart3D(title, horizontalAxisLabel, verticalAxisLabel, dataset, PlotOrientation.VERTICAL, showLegend, false, false); } else { chart = ChartFactory.createBarChart(title, horizontalAxisLabel, verticalAxisLabel, dataset, PlotOrientation.VERTICAL, showLegend, false, false); } CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); CategoryLabelPositions categoryLabelPositions = CategoryLabelPositions .createUpRotationLabelPositions(categoryLabelRotation); domainAxis.setCategoryLabelPositions(categoryLabelPositions); } else { // TODO Make the dateAxis argument a style property chart = ChartFactory.createXYBarChart(title, horizontalAxisLabel, false, verticalAxisLabel, new IntervalSeriesDataset(seriesNameKey, chartData), PlotOrientation.VERTICAL, showLegend, false, false); } return chart; }
From source file:org.jfree.chart.demo.StackedBarChart3DDemo1.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 1", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); barrenderer.setBaseItemLabelsVisible(true); barrenderer/* www .jav a 2 s . c o m*/ .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); barrenderer .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return jfreechart; }
From source file:org.jfree.chart.demo.StackedBarChart3DDemo3.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 3", "Category", "Value", categorydataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); barrenderer.setBaseItemLabelsVisible(true); barrenderer/* www.j a v a2 s. c o m*/ .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); barrenderer .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return jfreechart; }
From source file:org.jfree.chart.demo.StackedBarChart3DDemo2.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 2", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); StackedBarRenderer3D stackedbarrenderer3d = (StackedBarRenderer3D) categoryplot.getRenderer(); stackedbarrenderer3d.setRenderAsPercentages(true); stackedbarrenderer3d.setDrawBarOutline(false); stackedbarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3}", NumberFormat.getIntegerInstance(), new DecimalFormat("0.0%"))); stackedbarrenderer3d.setBaseItemLabelsVisible(true); stackedbarrenderer3d/* www. j a va 2s.com*/ .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); stackedbarrenderer3d .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return jfreechart; }
From source file:org.jfree.chart.demo.StackedBarChart3DDemo4.java
private JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart 3D Demo 4", "Category", "Value", categorydataset, PlotOrientation.HORIZONTAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); StackedBarRenderer3D stackedbarrenderer3d = (StackedBarRenderer3D) categoryplot.getRenderer(); stackedbarrenderer3d.setRenderAsPercentages(true); stackedbarrenderer3d.setDrawBarOutline(false); stackedbarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{3}", NumberFormat.getIntegerInstance(), new DecimalFormat("0.0%"))); stackedbarrenderer3d.setBaseItemLabelsVisible(true); stackedbarrenderer3d//from ww w . j av a 2 s. c o m .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); stackedbarrenderer3d .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); return jfreechart; }