org.jfree.chart.renderer.category.StackedBarRenderer3D Java Examples
The following examples show how to use
org.jfree.chart.renderer.category.StackedBarRenderer3D.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param legend a flag specifying whether or not a legend is required. * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean legend) { CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); CategoryItemRenderer renderer = new StackedBarRenderer3D(); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #2
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the findRangeBounds() method. */ public void testFindRangeBounds() { StackedBarRenderer3D r = new StackedBarRenderer3D(); assertNull(r.findRangeBounds(null)); // an empty dataset should return a null range DefaultCategoryDataset dataset = new DefaultCategoryDataset(); assertNull(r.findRangeBounds(dataset)); dataset.addValue(1.0, "R1", "C1"); assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset)); dataset.addValue(-2.0, "R1", "C2"); assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); dataset.addValue(null, "R1", "C3"); assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); dataset.addValue(2.0, "R2", "C1"); assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset)); dataset.addValue(null, "R2", "C2"); assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset)); }
Example #3
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { StackedBarRenderer3D r1 = new StackedBarRenderer3D(); StackedBarRenderer3D r2 = new StackedBarRenderer3D(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #4
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #5
Source File: ChartFactory.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #6
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { StackedBarRenderer3D r1 = new StackedBarRenderer3D(); StackedBarRenderer3D r2 = new StackedBarRenderer3D(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #7
Source File: ChartFactory.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #8
Source File: ChartFactory.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #9
Source File: ChartFactory.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #10
Source File: ChartFactory.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { ParamChecks.nullNotPermitted(orientation, "orientation"); CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #11
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { StackedBarRenderer3D r1 = new StackedBarRenderer3D(); StackedBarRenderer3D r2 = new StackedBarRenderer3D(); assertEquals(r1, r2); }
Example #12
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Check that this class implements PublicCloneable. */ public void testPublicCloneable() { StackedBarRenderer3D r1 = new StackedBarRenderer3D(); assertTrue(r1 instanceof PublicCloneable); }
Example #13
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createStackedBar3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot(); StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D( bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble(), bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble() ); boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels(); stackedBarRenderer3D.setBaseItemLabelsVisible(isShowLabels); if(isShowLabels) { JRItemLabel itemLabel = bar3DPlot.getItemLabel(); stackedBarRenderer3D.setBaseItemLabelFont( getFontUtil().getAwtFont( getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale() ) ); if(itemLabel != null) { if(itemLabel.getColor() != null) { stackedBarRenderer3D.setBaseItemLabelPaint(itemLabel.getColor()); } else { stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } // categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor()); // if(itemLabel.getMask() != null) // { // barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( // StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, // new DecimalFormat(itemLabel.getMask()))); // } // else // { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); // } } else { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } } categoryPlot.setRenderer(stackedBarRenderer3D); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(), bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(), bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(), bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(), bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()) ); return jfreeChart; }
Example #14
Source File: StackedBarRenderer3DTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { StackedBarRenderer3D r1 = new StackedBarRenderer3D(); StackedBarRenderer3D r2 = new StackedBarRenderer3D(); assertEquals(r1, r2); }
Example #15
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createStackedBar3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot(); StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D( bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble(), bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble() ); boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels(); stackedBarRenderer3D.setBaseItemLabelsVisible(isShowLabels); if(isShowLabels) { JRItemLabel itemLabel = bar3DPlot.getItemLabel(); stackedBarRenderer3D.setBaseItemLabelFont( getFontUtil().getAwtFont( getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale() ) ); if(itemLabel != null) { if(itemLabel.getColor() != null) { stackedBarRenderer3D.setBaseItemLabelPaint(itemLabel.getColor()); } else { stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } // categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor()); // if(itemLabel.getMask() != null) // { // barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( // StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, // new DecimalFormat(itemLabel.getMask()))); // } // else // { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); // } } else { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } } categoryPlot.setRenderer(stackedBarRenderer3D); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(), bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(), bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(), bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(), bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #16
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseURLGenerator(new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
Example #17
Source File: ChartFactory.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * Creates a stacked bar chart with a 3D effect and default settings. The * chart object returned by this method uses a {@link CategoryPlot} * instance as the plot, with a {@link CategoryAxis3D} for the domain axis, * a {@link NumberAxis3D} as the range axis, and a * {@link StackedBarRenderer3D} as the renderer. * * @param title the chart title (<code>null</code> permitted). * @param categoryAxisLabel the label for the category axis * (<code>null</code> permitted). * @param valueAxisLabel the label for the value axis (<code>null</code> * permitted). * @param dataset the dataset for the chart (<code>null</code> permitted). * @param orientation the orientation (horizontal or vertical) * (<code>null</code> not permitted). * @param legend a flag specifying whether or not a legend is required. * @param tooltips configure chart to generate tool tips? * @param urls configure chart to generate URLs? * * @return A stacked bar chart with a 3D effect. */ public static JFreeChart createStackedBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); // create the renderer... CategoryItemRenderer renderer = new StackedBarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } // create the plot... CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(orientation); if (orientation == PlotOrientation.HORIZONTAL) { // change rendering order to ensure that bar overlapping is the // right way around plot.setColumnRenderingOrder(SortOrder.DESCENDING); } // create the chart... JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
Example #18
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createStackedBar3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBar3DPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); JRBar3DPlot bar3DPlot = (JRBar3DPlot)getPlot(); StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D( bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET : bar3DPlot.getXOffsetDouble(), bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble() ); boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels(); stackedBarRenderer3D.setBaseItemLabelsVisible(isShowLabels); if (isShowLabels) { JRItemLabel itemLabel = bar3DPlot.getItemLabel(); stackedBarRenderer3D.setBaseItemLabelFont( fontUtil.getAwtFont( getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale() ) ); if (itemLabel != null) { if (itemLabel.getColor() != null) { stackedBarRenderer3D.setBaseItemLabelPaint(itemLabel.getColor()); } else { stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } // categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor()); // if (itemLabel.getMask() != null) // { // barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( // StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, // new DecimalFormat(itemLabel.getMask()))); // } // else // { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); // } } else { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator)getLabelGenerator()); stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } } categoryPlot.setRenderer(stackedBarRenderer3D); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(), bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(), bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(), bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(), bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(), bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(), bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }