/** * Creates and returns a default instance of a box and whisker chart. * * @param title the chart title (<code>null</code> permitted). * @param timeAxisLabel a label for the time axis (<code>null</code> permitted). * @param valueAxisLabel a 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 box and whisker chart. */ public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel, BoxAndWhiskerXYDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
/** * Creates and returns a default instance of a box and whisker chart. * * @param title the chart title (<code>null</code> permitted). * @param timeAxisLabel a label for the time axis (<code>null</code> * permitted). * @param valueAxisLabel a 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 box and whisker chart. */ public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel, BoxAndWhiskerXYDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); }
/** * Creates and returns a default instance of a box and whisker chart. * * @param title the chart title (<code>null</code> permitted). * @param timeAxisLabel a label for the time axis (<code>null</code> * permitted). * @param valueAxisLabel a 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 box and whisker chart. */ public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel, BoxAndWhiskerXYDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * Creates and returns a default instance of a box and whisker chart. * * @param title the chart title ({@code null} permitted). * @param timeAxisLabel a label for the time axis ({@code null} * permitted). * @param valueAxisLabel a label for the value axis ({@code null} * permitted). * @param dataset the dataset for the chart ({@code null} permitted). * @param legend a flag specifying whether or not a legend is required. * * @return A box and whisker chart. */ public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel, BoxAndWhiskerXYDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * Problem that the equals(...) method distinguishes all fields. */ public void testEquals() { XYBoxAndWhiskerRenderer r1 = new XYBoxAndWhiskerRenderer(); XYBoxAndWhiskerRenderer r2 = new XYBoxAndWhiskerRenderer(); assertEquals(r1, r2); r1.setPaint(Color.yellow); assertFalse(r1.equals(r2)); r2.setPaint(Color.yellow); assertEquals(r1, r2); r1.setArtifactPaint(Color.yellow); assertFalse(r1.equals(r2)); r2.setArtifactPaint(Color.yellow); assertEquals(r1, r2); r1.setBoxWidth(0.55); assertFalse(r1.equals(r2)); r2.setBoxWidth(0.55); assertEquals(r1, r2); r1.setFillBox(!r1.getFillBox()); assertFalse(r1.equals(r2)); r2.setFillBox(!r2.getFillBox()); assertEquals(r1, r2); }
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { XYBoxAndWhiskerRenderer r1 = new XYBoxAndWhiskerRenderer(); XYBoxAndWhiskerRenderer r2 = new XYBoxAndWhiskerRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { XYBoxAndWhiskerRenderer r1 = new XYBoxAndWhiskerRenderer(); XYBoxAndWhiskerRenderer r2 = new XYBoxAndWhiskerRenderer(); assertEquals(r1, r2); r1.setPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.red)); assertFalse(r1.equals(r2)); r2.setPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.red)); assertEquals(r1, r2); r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red)); assertFalse(r1.equals(r2)); r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red)); assertEquals(r1, r2); r1.setBoxWidth(0.55); assertFalse(r1.equals(r2)); r2.setBoxWidth(0.55); assertEquals(r1, r2); r1.setFillBox(!r1.getFillBox()); assertFalse(r1.equals(r2)); r2.setFillBox(!r2.getFillBox()); assertEquals(r1, r2); }
/** * Check that the equals() method distinguishes all fields. */ public void testEquals() { XYBoxAndWhiskerRenderer r1 = new XYBoxAndWhiskerRenderer(); XYBoxAndWhiskerRenderer r2 = new XYBoxAndWhiskerRenderer(); assertEquals(r1, r2); r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red)); assertFalse(r1.equals(r2)); r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red)); assertEquals(r1, r2); r1.setBoxWidth(0.55); assertFalse(r1.equals(r2)); r2.setBoxWidth(0.55); assertEquals(r1, r2); r1.setFillBox(!r1.getFillBox()); assertFalse(r1.equals(r2)); r2.setFillBox(!r2.getFillBox()); assertEquals(r1, r2); r1.setBoxPaint(Color.yellow); assertFalse(r1.equals(r2)); r2.setBoxPaint(Color.yellow); assertEquals(r1, r2); // check boxPaint null also r1.setBoxPaint(null); assertFalse(r1.equals(r2)); r2.setBoxPaint(null); assertEquals(r1, r2); }
/** * Verify that this class implements {@link PublicCloneable}. */ public void testPublicCloneable() { XYBoxAndWhiskerRenderer r1 = new XYBoxAndWhiskerRenderer(); assertTrue(r1 instanceof PublicCloneable); }