private AnnotatedChartModel createSineModel() {
   DefaultChartModel model = new DefaultChartModel("Sine");
   int numIntervals = 36;
   for (int i = 0; i <= numIntervals; i++) {
     double x = (360.0 * i) / numIntervals;
     double y = 20 + 20 * Math.sin(x * 2 * Math.PI / 360.0);
     if (y < 0) {
       y = 0;
     }
     ChartPoint p = new ChartPoint(x, y);
     model.addPoint(p);
   }
   // You can just pass a simple string to use as the label, but here we use the html mark-up
   ChartLabel label =
       new ChartLabel(
           new RealPosition(230.0),
           new RealPosition(38.5),
           "<html>A <span style='color:black'><b><u>Sine</u></b></span> Wave</html>");
   label.setRotation(-Math.PI / 6);
   label.setColor(Color.gray);
   model.addAnnotation(label);
   ChartArrow arrow = new ChartArrow(new Point(225, 36), new Point(150, 30));
   arrow.setFromPixelOffset(new Point(-30, 0));
   model.addAnnotation(arrow);
   return model;
 }
 private AnnotatedChartModel createCosineModel() {
   DefaultChartModel model = new DefaultChartModel("Cosine");
   int numIntervals = 36;
   for (int i = 0; i <= numIntervals; i++) {
     double x = (360.0 * i) / numIntervals;
     double y = Math.cos(x * 2 * Math.PI / 360.0);
     ChartPoint p = new ChartPoint(x, y);
     model.addPoint(p);
   }
   ChartLabel label = new ChartLabel(new RealPosition(75.0), new RealPosition(8.0));
   // As before we could simply use a basic string, but we are demonstrating the rich text mark-up
   // possibility
   label.setLabel(
       "<html><p style='text-align:center'>A <span style='color:black'><b><u>Cosine</u></b></span><br>Wave</p></html>");
   label.setColor(Color.gray);
   model.addAnnotation(label);
   ChartArrow arrow = new ChartArrow(new Point(75, 8), new Point(100, 20));
   arrow.setFromPixelOffset(new Point(0, -10));
   model.addAnnotation(arrow);
   return model;
 }