Beispiel #1
0
  public Dataset filterDatasetCatGroups(Dataset dataset, Vector groups) {
    logger.debug("IN");
    DefaultCategoryDataset catDataset = (DefaultCategoryDataset) dataset;

    // keeps track of wich series has to be shown
    currentCatGroups = groups;
    String catGroup = "";
    // List rowKeys=new Vector();

    // List rowKeys=new Vector(catDataset.getRowKeys());
    List colKeys = new Vector(catDataset.getColumnKeys());

    for (Iterator iterator = colKeys.iterator(); iterator.hasNext(); ) {
      String col = (String) iterator.next();
      // iterate on cols, get their group and see if it has to be kept
      catGroup = (String) catGroups.get(col);
      if (!(groups.contains(catGroup))) {
        catDataset.removeColumn(col);
        catGroupNames.remove(col);
      }
    }

    logger.debug("OUT");
    return catDataset;
  }
Beispiel #2
0
  /**
   * Use for slider: limits the categories visualization from cat selected to cat
   * selected+numberscatsVisualization.
   *
   * @param dataset the dataset
   * @param categories the categories
   * @param catSelected the cat selected
   * @param numberCatsVisualization the number cats visualization
   * @return the dataset
   */
  public Dataset filterDataset(
      Dataset dataset, HashMap categories, int catSelected, int numberCatsVisualization) {
    logger.debug("IN");
    DefaultCategoryDataset catDataset = (DefaultCategoryDataset) dataset;

    int numCats = categories.size();
    Vector visCat = new Vector();
    // from the choice point to min(chose point+interval, end point)
    // int startPoint=((catSelected-1)*numberCatsVisualization)+1;
    int startPoint = catSelected;

    int endPoint;
    if ((startPoint + numberCatsVisualization - 1) <= (categories.size()))
      endPoint = startPoint + numberCatsVisualization - 1;
    else endPoint = categories.size();

    for (int i = (startPoint); i <= endPoint; i++) {
      String name = (String) categories.get(new Integer(i));
      visCat.add(name);
    }

    List columns = new Vector(catDataset.getColumnKeys());
    for (Iterator iterator = columns.iterator(); iterator.hasNext(); ) {
      String col = (String) iterator.next();
      if (!(visCat.contains(col))) {
        catDataset.removeColumn(col);
      }
    }
    logger.debug("OUT");

    return catDataset;
  }