@Override protected JFreeChart createBar3DChart() throws JRException { JFreeChart jfreeChart = super.createBar3DChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer(); barRenderer3D = new GradientBarRenderer3D(barRenderer3D); categoryPlot.setRenderer(barRenderer3D); barRenderer3D.setItemMargin(0); barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT); //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL); barRenderer3D.setItemMargin(0); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer3D.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i)); } } return jfreeChart; }
@Override protected JFreeChart createBar3DChart() throws JRException { JFreeChart jfreeChart = super.createBar3DChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer(); barRenderer3D.setItemMargin(0); barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT); //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL); CategoryDataset categoryDataset = categoryPlot.getDataset(); if(categoryDataset != null) { for(int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer3D.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); } } return jfreeChart; }
@Override protected JFreeChart createStackedBar3DChart() throws JRException { JFreeChart jfreeChart = super.createStackedBar3DChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer(); barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT); barRenderer3D.setItemMargin(0); CategoryDataset categoryDataset = categoryPlot.getDataset(); if(categoryDataset != null) { for(int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer3D.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT); } } return jfreeChart; }
protected JFreeChart createLegend(CategoryDataset dataset) { // JFreeChart chart = ChartFactory.createAreaChart( JFreeChart chart = ChartFactory.createBarChart3D( chartTitle, // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); // renderer.setDrawOutlines(true); // renderer.setUseFillPaint(true); // renderer.setFillPaint(Color.white); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); return chart; }
private void set3d(Plot plot) { if(!show3d) return; plot.setForegroundAlpha(0.6f); if(plot instanceof CategoryPlot) { plot.setForegroundAlpha(0.8f); CategoryPlot cp=(CategoryPlot) plot; CategoryItemRenderer renderer = cp.getRenderer(); if(renderer instanceof BarRenderer3D) { BarRenderer3D br3d=(BarRenderer3D) renderer; cp.setRenderer(new BarRenderer3DWrap(br3d,xoffset,yoffset)); } } else if(plot instanceof PiePlot3D) { PiePlot3D pp3d=(PiePlot3D) plot; pp3d.setDepthFactor(0.10); } //CategoryItemRenderer renderer = plot.getRenderer(); }
/** * Creates a bar chart with a 3D effect. 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 BarRenderer3D} 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 bar chart with a 3D effect. */ public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean legend) { CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel); ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel); BarRenderer3D renderer = new BarRenderer3D(); renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setForegroundAlpha(0.75f); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
private static JFreeChart createBarChart(String title,String category,String value, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title category, // domain axis label value, // range axis label dataset, // data PlotOrientation.VERTICAL, // 图标方向 true, // 是否显示legend true, // 是否显示tooltips false // 是否显示URLs ); CategoryPlot plot = chart.getCategoryPlot();//设置图的高级属性 plot.setBackgroundPaint(ChartColor.WHITE); NumberAxis na= (NumberAxis)plot.getRangeAxis(); // na.setAutoTickUnitSelection(false);//设置小数点位数 na.setNumberFormatOverride(df); // NumberTickUnit nt=new NumberTickUnit(1.22); // na.setTickUnit(nt); // plot.setRangeAxis(na); BarRenderer3D renderer = new BarRenderer3D();//3D属性修改 renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setItemLabelAnchorOffset(10); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER)); renderer.setSeriesPaint(0,new Color(34,139,34)); renderer.setSeriesPaint(1,new Color(154,205,50)); renderer.setSeriesPaint(2,new Color(0,255,0)); renderer.setSeriesPaint(3,new Color(127,255,212)); plot.setRenderer(renderer);//将修改后的属性值保存到图中 return chart; }
/** * Creates a bar chart with a 3D effect. * <P> * 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 BarRenderer3D} 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 plot 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 bar chart with a 3D effect. */ public static JFreeChart createBarChart3D(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); BarRenderer3D renderer = new BarRenderer3D(); if (tooltips) { renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setItemURLGenerator(new StandardCategoryURLGenerator()); } 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.setRowRenderingOrder(SortOrder.DESCENDING); plot.setColumnRenderingOrder(SortOrder.DESCENDING); } plot.setForegroundAlpha(0.75f); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { BarRenderer3D r1 = new BarRenderer3D(); BarRenderer3D r2 = new BarRenderer3D(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
/** * Creates a bar chart with a 3D effect. 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 BarRenderer3D} 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 plot 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 bar chart with a 3D effect. */ public static JFreeChart createBarChart3D(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); BarRenderer3D renderer = new BarRenderer3D(); if (tooltips) { renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); } if (urls) { renderer.setBaseItemURLGenerator( new StandardCategoryURLGenerator()); } 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.setRowRenderingOrder(SortOrder.DESCENDING); plot.setColumnRenderingOrder(SortOrder.DESCENDING); } plot.setForegroundAlpha(0.75f); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). * @param shadow a flag that controls whether a shadow generator is * included. * * @since 1.0.14 */ public StandardChartTheme(String name, boolean shadow) { ParamChecks.nullNotPermitted(name, "name"); this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.smallFont = new Font("Tahoma", Font.PLAIN, 10); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.baselinePaint = Color.black; this.crosshairPaint = Color.blue; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = false; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; this.shadowGenerator = shadow ? new DefaultShadowGenerator() : null; }
@Override protected JFreeChart createStackedBar3DChart() throws JRException { JFreeChart jfreeChart = super.createStackedBar3DChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); BarRenderer3D barRenderer3D = (BarRenderer3D)categoryPlot.getRenderer(); barRenderer3D.setWallPaint(ChartThemesConstants.TRANSPARENT_PAINT); //CategoryDataset categoryDataset = categoryPlot.getDataset(); barRenderer3D.setItemMargin(0); return jfreeChart; }
/** * Creates a chart. * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D( chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.HORIZONTAL, // orientation !legendPanelOn, // include legend true, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); plot.setForegroundAlpha(1.0f); // left align the category labels... CategoryAxis axis = plot.getDomainAxis(); CategoryLabelPositions p = axis.getCategoryLabelPositions(); CategoryLabelPosition left = new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, 0.0, CategoryLabelWidthType.RANGE, 0.30f ); axis.setCategoryLabelPositions(CategoryLabelPositions.replaceLeftPosition(p, left)); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); setCategorySummary(dataset); return chart; }
/** * Creates a 3D bar chart. * * @param dataset the category dataset. * * @return The chart. */ protected JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart3D( chartTitle, // chart title domainLabel, // domain axis label rangeLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation !legendPanelOn, // include legend true, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions( Math.PI / 8.0)); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); renderer.setDrawBarOutline(false); setCategorySummary(dataset); return chart; }
/** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). */ public StandardChartTheme(String name) { if (name == null) { throw new IllegalArgumentException("Null 'name' argument."); } this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.smallFont = new Font("Tahoma", Font.PLAIN, 10); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.crosshairPaint = Color.blue; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = true; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; }
private JFreeChart createBarChart(ReportChart reportChart, ChartValue[] values, boolean displayInline) { CategoryDataset dataset = createCategoryDataset(values); CategoryAxis3D categoryAxis = new CategoryAxis3D(reportChart.getXAxisLabel()); ValueAxis valueAxis = new NumberAxis3D(reportChart.getYAxisLabel()); BarRenderer3D renderer = new BarRenderer3D(); renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); if (reportChart.getDrillDownReport() != null) { renderer.setItemURLGenerator(new StandardCategoryURLGenerator( "executeReport.action?displayInline=" + displayInline + "&exportType=0&reportId=" + reportChart.getDrillDownReport().getId(), "series", ReportChart.DRILLDOWN_PARAMETER)); } CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL) { plot.setOrientation(PlotOrientation.HORIZONTAL); } JFreeChart chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend()); return chart; }
/** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). */ public StandardChartTheme(String name) { if (name == null) { throw new IllegalArgumentException("Null 'name' argument."); } this.name = name; this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20); this.largeFont = new Font("Tahoma", Font.BOLD, 14); this.regularFont = new Font("Tahoma", Font.PLAIN, 12); this.smallFont = new Font("Tahoma", Font.PLAIN, 10); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.baselinePaint = Color.black; this.crosshairPaint = Color.blue; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = true; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; }
/** * Creates a new default instance. * * @param name the name of the theme (<code>null</code> not permitted). * @param shadow a flag that controls whether a shadow generator is * included. * * @since 1.0.14 */ public StandardChartTheme(String name, boolean shadow) { ParamChecks.nullNotPermitted(name, "name"); this.name = name; this.extraLargeFont = new Font(JFreeChart.getFont(), Font.BOLD, 20); this.largeFont = new Font(JFreeChart.getFont(), Font.BOLD, 14); this.regularFont = new Font(JFreeChart.getFont(), Font.PLAIN, 12); this.smallFont = new Font(JFreeChart.getFont(), Font.PLAIN, 10); this.titlePaint = Color.black; this.subtitlePaint = Color.black; this.legendBackgroundPaint = Color.white; this.legendItemPaint = Color.darkGray; this.chartBackgroundPaint = Color.white; this.drawingSupplier = new DefaultDrawingSupplier(); this.plotBackgroundPaint = Color.lightGray; this.plotOutlinePaint = Color.black; this.labelLinkPaint = Color.black; this.labelLinkStyle = PieLabelLinkStyle.CUBIC_CURVE; this.axisOffset = new RectangleInsets(4, 4, 4, 4); this.domainGridlinePaint = Color.white; this.rangeGridlinePaint = Color.white; this.baselinePaint = Color.black; this.crosshairPaint = Color.blue; this.axisLabelPaint = Color.darkGray; this.tickLabelPaint = Color.darkGray; this.barPainter = new GradientBarPainter(); this.xyBarPainter = new GradientXYBarPainter(); this.shadowVisible = false; this.shadowPaint = Color.gray; this.itemLabelPaint = Color.black; this.thermometerPaint = Color.white; this.wallPaint = BarRenderer3D.DEFAULT_WALL_PAINT; this.errorIndicatorPaint = Color.black; this.shadowGenerator = shadow ? new DefaultShadowGenerator() : null; }
@Override public void test() { super.test(); numberOfPagesTest(1); JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", StackedBarRenderer3D.class, categoryPlot.getRenderer().getClass()); BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer(); Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible()); Assert.assertEquals("x offset", 2d, renderer.getXOffset()); Assert.assertEquals("y offset", 3d, renderer.getYOffset()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }
@Override public void test() { super.test(); numberOfPagesTest(1); JFreeChart chart = getChart("summary.chart1", 0); CategoryPlot categoryPlot = chart.getCategoryPlot(); Assert.assertEquals("renderer", BarRenderer3D.class, categoryPlot.getRenderer().getClass()); BarRenderer3D renderer = (BarRenderer3D) categoryPlot.getRenderer(); Assert.assertTrue("show labels", renderer.getBaseItemLabelsVisible()); Assert.assertEquals("x offset", 2d, renderer.getXOffset()); Assert.assertEquals("y offset", 3d, renderer.getYOffset()); chart = getChart("summary.chart2", 0); Axis axis = chart.getCategoryPlot().getDomainAxis(); Assert.assertEquals("category label", "category", axis.getLabel()); Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions().getLabelPosition(RectangleEdge.LEFT); Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle()); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); chart = getChart("summary.chart3", 0); axis = chart.getCategoryPlot().getRangeAxis(); Assert.assertEquals("value label", "value", axis.getLabel()); Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint()); Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont()); Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint()); Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont()); Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10)); Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint()); Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound()); Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound()); }