private static JFreeChart createChart(CategoryDataset categorydataset) {
   JFreeChart jfreechart =
       ChartFactory.createLineChart(
           "Statistical Line Chart Demo 1",
           "Type",
           "Value",
           categorydataset,
           PlotOrientation.VERTICAL,
           true,
           true,
           false);
   jfreechart.setBackgroundPaint(Color.white);
   CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
   categoryplot.setBackgroundPaint(Color.lightGray);
   categoryplot.setRangeGridlinePaint(Color.white);
   CategoryAxis categoryaxis = categoryplot.getDomainAxis();
   categoryaxis.setUpperMargin(0.0D);
   categoryaxis.setLowerMargin(0.0D);
   NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
   numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   numberaxis.setAutoRangeIncludesZero(true);
   StatisticalLineAndShapeRenderer statisticallineandshaperenderer =
       new StatisticalLineAndShapeRenderer(true, false);
   statisticallineandshaperenderer.setUseSeriesOffset(true);
   categoryplot.setRenderer(statisticallineandshaperenderer);
   return jfreechart;
 }
 /** Two objects that are equal are required to return the same hashCode. */
 @Test
 public void testHashcode() {
   StatisticalLineAndShapeRenderer r1 = new StatisticalLineAndShapeRenderer();
   StatisticalLineAndShapeRenderer r2 = new StatisticalLineAndShapeRenderer();
   assertTrue(r1.equals(r2));
   int h1 = r1.hashCode();
   int h2 = r2.hashCode();
   assertEquals(h1, h2);
 }
  /** A simple test for bug report 1562759. */
  @Test
  public void test1562759() {
    StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer(true, false);
    assertTrue(r.getBaseLinesVisible());
    assertFalse(r.getBaseShapesVisible());

    r = new StatisticalLineAndShapeRenderer(false, true);
    assertFalse(r.getBaseLinesVisible());
    assertTrue(r.getBaseShapesVisible());
  }
  /** Some checks for the findRangeBounds() method. */
  @Test
  public void testFindRangeBounds() {
    StatisticalLineAndShapeRenderer r = new StatisticalLineAndShapeRenderer();
    assertNull(r.findRangeBounds(null));

    // an empty dataset should return a null range
    DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
    assertNull(r.findRangeBounds(dataset));

    dataset.add(1.0, 0.5, "R1", "C1");
    assertEquals(new Range(0.5, 1.5), r.findRangeBounds(dataset));

    dataset.add(-2.0, 0.2, "R1", "C2");
    assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset));

    dataset.add(null, null, "R1", "C3");
    assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset));

    dataset.add(5.0, 1.0, "R2", "C3");
    assertEquals(new Range(-2.2, 6.0), r.findRangeBounds(dataset));

    // check that the series visible flag is observed
    r.setSeriesVisible(1, Boolean.FALSE);
    assertEquals(new Range(-2.2, 1.5), r.findRangeBounds(dataset));
  }
  /** Check that the equals() method distinguishes all fields. */
  @Test
  public void testEquals() {
    StatisticalLineAndShapeRenderer r1 = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
  }
 /** Confirm that cloning works. */
 @Test
 public void testCloning() throws CloneNotSupportedException {
   StatisticalLineAndShapeRenderer r1 = new StatisticalLineAndShapeRenderer();
   StatisticalLineAndShapeRenderer r2 = (StatisticalLineAndShapeRenderer) r1.clone();
   assertTrue(r1 != r2);
   assertTrue(r1.getClass() == r2.getClass());
   assertTrue(r1.equals(r2));
 }