示例#1
0
  /**
   * Adds a series, plus a (possibly null) SeriesChangeListener which will receive a <i>single</i>
   * event if/when the series is deleted from the chart by the user. Returns the series attributes.
   */
  public SeriesAttributes addSeries(Collection objs, String name, SeriesChangeListener stopper) {
    int i = getSeriesCount();

    // need to have added the dataset BEFORE calling this since it'll try to change the name of the
    // series
    PieChartSeriesAttributes csa = buildNewAttributes(name, stopper);

    // set information
    csa.setElements(new ArrayList(objs));

    seriesAttributes.add(csa);

    revalidate(); // display the new series panel
    update();

    // won't update properly unless I force it here by letting all the existing scheduled events to
    // go through.  Dumb design.  :-(
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            update();
          }
        });

    return csa;
  }
示例#2
0
 public void moveSeries(int index, boolean up) {
   super.moveSeries(index, up);
   update();
 }
示例#3
0
 public void removeSeries(int index) {
   super.removeSeries(index);
   update();
 }