public void chartProgress(ChartProgressEvent chartprogressevent) {
   if (chartprogressevent.getType() != 2) return;
   if (chartPanel != null) {
     JFreeChart jfreechart = chartPanel.getChart();
     if (jfreechart != null) {
       XYPlot xyplot = (XYPlot) jfreechart.getPlot();
       XYDataset xydataset = xyplot.getDataset();
       @SuppressWarnings("rawtypes")
       Comparable comparable = xydataset.getSeriesKey(0);
       double d = xyplot.getDomainCrosshairValue();
       model.setValueAt(comparable, 0, 0);
       long l = (long) d;
       model.setValueAt(new Long(l), 0, 1);
       int i = series.getIndex(new Minute(new Date(l)));
       if (i >= 0) {
         TimeSeriesDataItem timeseriesdataitem =
             series.getDataItem(Math.min(199, Math.max(0, i)));
         TimeSeriesDataItem timeseriesdataitem1 = series.getDataItem(Math.max(0, i - 1));
         TimeSeriesDataItem timeseriesdataitem2 = series.getDataItem(Math.min(199, i + 1));
         long l1 = timeseriesdataitem.getPeriod().getMiddleMillisecond();
         double d1 = timeseriesdataitem.getValue().doubleValue();
         long l2 = timeseriesdataitem1.getPeriod().getMiddleMillisecond();
         double d2 = timeseriesdataitem1.getValue().doubleValue();
         long l3 = timeseriesdataitem2.getPeriod().getMiddleMillisecond();
         double d3 = timeseriesdataitem2.getValue().doubleValue();
         model.setValueAt(new Long(l1), 0, 1);
         model.setValueAt(new Double(d1), 0, 2);
         model.setValueAt(new Long(l2), 0, 3);
         model.setValueAt(new Double(d2), 0, 4);
         model.setValueAt(new Long(l3), 0, 5);
         model.setValueAt(new Double(d3), 0, 6);
       }
     }
   }
 }
  public void chartProgress(ChartProgressEvent chartprogressevent) {
    if (chartprogressevent.getType() != 2) return;

    XYPlot xyplot = (XYPlot) chart.getPlot();

    double pos = xyplot.getDomainCrosshairValue();

    // this is needed because the call of highlightPatternInChart triggers a ChartProgessEvent
    if (previousClickPosition == pos) return;

    // SAXString sax = new SAXString(chartData.getFreqData(), " ");
    // String rule = sax.getRuleFromPosition(chartData, (int) pos);
    // if (rule != null) {
    // firePropertyChange(SequiturMessage.MAIN_CHART_CLICKED_MESSAGE, "", rule);
    // System.out.println("Clicked Property Change fired with rule: " + rule);
    // }

    previousClickPosition = pos;
  }
    /**
     * Handles a chart progress event.
     *
     * @param event the event.
     */
    public void chartProgress(ChartProgressEvent event) {
      if (event.getType() != ChartProgressEvent.DRAWING_FINISHED) {
        return;
      }
      if (this.chartPanel != null) {
        JFreeChart c = this.chartPanel.getChart();
        if (c != null) {
          XYPlot plot = c.getXYPlot();
          XYDataset dataset = plot.getDataset();
          Comparable seriesKey = dataset.getSeriesKey(0);
          double xx = plot.getDomainCrosshairValue();

          // update the table...
          this.model.setValueAt(seriesKey, 0, 0);
          long millis = (long) xx;
          this.model.setValueAt(new Long(millis), 0, 1);
          int itemIndex = this.series.getIndex(new Minute(new Date(millis)));
          if (itemIndex >= 0) {
            TimeSeriesDataItem item =
                this.series.getDataItem(Math.min(199, Math.max(0, itemIndex)));
            TimeSeriesDataItem prevItem = this.series.getDataItem(Math.max(0, itemIndex - 1));
            TimeSeriesDataItem nextItem = this.series.getDataItem(Math.min(199, itemIndex + 1));
            long x = item.getPeriod().getMiddleMillisecond();
            double y = item.getValue().doubleValue();
            long prevX = prevItem.getPeriod().getMiddleMillisecond();
            double prevY = prevItem.getValue().doubleValue();
            long nextX = nextItem.getPeriod().getMiddleMillisecond();
            double nextY = nextItem.getValue().doubleValue();
            this.model.setValueAt(new Long(x), 0, 1);
            this.model.setValueAt(new Double(y), 0, 2);
            this.model.setValueAt(new Long(prevX), 0, 3);
            this.model.setValueAt(new Double(prevY), 0, 4);
            this.model.setValueAt(new Long(nextX), 0, 5);
            this.model.setValueAt(new Double(nextY), 0, 6);
          }
        }
      }
    }