org.jfree.chart.renderer.category.WaterfallBarRenderer Java Examples
The following examples show how to use
org.jfree.chart.renderer.category.WaterfallBarRenderer.
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: WaterfallBarRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { WaterfallBarRenderer r1 = new WaterfallBarRenderer(); WaterfallBarRenderer r2 = new WaterfallBarRenderer(); assertEquals(r1, r2); // firstBarPaint; r1.setFirstBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setFirstBarPaint(Color.cyan); assertTrue(r1.equals(r2)); // lastBarPaint; r1.setLastBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setLastBarPaint(Color.cyan); assertTrue(r1.equals(r2)); // positiveBarPaint; r1.setPositiveBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setPositiveBarPaint(Color.cyan); assertTrue(r1.equals(r2)); //private Paint negativeBarPaint; r1.setNegativeBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setNegativeBarPaint(Color.cyan); assertTrue(r1.equals(r2)); }
Example #2
Source File: WaterfallBarRendererTests.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() { WaterfallBarRenderer r1 = new WaterfallBarRenderer(); WaterfallBarRenderer r2 = new WaterfallBarRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #3
Source File: ChartFactory.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a waterfall chart. The chart object returned by this method * uses a {@link CategoryPlot} instance as the plot, with a * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the * range axis, and a {@link WaterfallBarRenderer} 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 waterfall chart. */ public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean legend) { CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); categoryAxis.setCategoryMargin(0.0); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); WaterfallBarRenderer renderer = new WaterfallBarRenderer(); ItemLabelPosition position = new ItemLabelPosition( ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0); renderer.setBasePositiveItemLabelPosition(position); renderer.setBaseNegativeItemLabelPosition(position); StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator(); renderer.setBaseToolTipGenerator(generator); CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); plot.clearRangeMarkers(); Marker baseline = new ValueMarker(0.0); baseline.setPaint(Color.black); plot.addRangeMarker(baseline, Layer.FOREGROUND); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
Example #4
Source File: WaterfallBarRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { WaterfallBarRenderer r1 = new WaterfallBarRenderer(); WaterfallBarRenderer r2 = new WaterfallBarRenderer(); assertEquals(r1, r2); // firstBarPaint; r1.setFirstBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setFirstBarPaint(Color.cyan); assertTrue(r1.equals(r2)); // lastBarPaint; r1.setLastBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setLastBarPaint(Color.cyan); assertTrue(r1.equals(r2)); // positiveBarPaint; r1.setPositiveBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setPositiveBarPaint(Color.cyan); assertTrue(r1.equals(r2)); //private Paint negativeBarPaint; r1.setNegativeBarPaint(Color.cyan); assertFalse(r1.equals(r2)); r2.setNegativeBarPaint(Color.cyan); assertTrue(r1.equals(r2)); }
Example #5
Source File: WaterfallBarRendererTests.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() { WaterfallBarRenderer r1 = new WaterfallBarRenderer(); WaterfallBarRenderer r2 = new WaterfallBarRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #6
Source File: WaterfallBarRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Some tests for the findRangeBounds() method. */ public void testFindRangeBounds() { WaterfallBarRenderer r = new WaterfallBarRenderer(); assertNull(r.findRangeBounds(null)); }
Example #7
Source File: WaterfallBarRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Check that this class implements PublicCloneable. */ public void testPublicCloneable() { WaterfallBarRenderer r1 = new WaterfallBarRenderer(); assertTrue(r1 instanceof PublicCloneable); }