private CategoryDataset createDataset() {
   DefaultCategoryDataset setCategory = new DefaultCategoryDataset();
   try {
     Part part = this.mainFrame.getCurrentPart();
     BookModel model = this.mainFrame.getBookModel();
     Session session = model.beginTransaction();
     StrandDAOImpl daoStrand = new StrandDAOImpl(session);
     List strands = daoStrand.findAll();
     SceneDAOImpl daoScene = new SceneDAOImpl(session);
     List scenes = daoScene.findDistinctDates(part);
     double d = 0.0D;
     Iterator iStrand = strands.iterator();
     while (iStrand.hasNext()) {
       Strand strand = (Strand) iStrand.next();
       Iterator iScene = scenes.iterator();
       while (iScene.hasNext()) {
         Date date = (Date) iScene.next();
         long l = daoStrand.countByDate(date, strand);
         setCategory.addValue(l, strand, date);
         d += l;
       }
     }
     model.commit();
     this.average = (d / (strands.size() + scenes.size()));
   } catch (Exception exc) {
     System.err.println("StrandsByDateChart.createDataset() Exception : " + exc.getMessage());
   }
   return setCategory;
 }
 private JFreeChart createChart(CategoryDataset setCategory) {
   JFreeChart chart =
       ChartFactory.createBarChart(
           this.chartTitle, "", "", setCategory, PlotOrientation.VERTICAL, true, true, false);
   CategoryPlot plot = (CategoryPlot) chart.getPlot();
   plot.addRangeMarker(ChartUtil.getAverageMarker(this.average), Layer.FOREGROUND);
   BookModel model = this.mainFrame.getBookModel();
   Session session = model.beginTransaction();
   StrandDAOImpl daoStrand = new StrandDAOImpl(session);
   List strands = daoStrand.findAll();
   model.commit();
   Color[] colors = new Color[strands.size()];
   int i = 0;
   Object iObject = strands.iterator();
   while (((Iterator) iObject).hasNext()) {
     Strand strand = (Strand) ((Iterator) iObject).next();
     colors[i] = ColorUtil.darker(strand.getJColor(), 0.25D);
     i++;
   }
   iObject = (BarRenderer) plot.getRenderer();
   for (int j = 0; j < setCategory.getRowCount(); j++) {
     Color color = colors[(j % colors.length)];
     ((BarRenderer) iObject).setSeriesPaint(j, color);
   }
   return chart;
 }