/**
   * Set the current DimsDataList to what is defined in the pass in map.
   *
   * @param map
   * @param shape
   */
  public void fromMap(Map<Integer, String> map, int[] shape) {

    clear();

    for (int i = 0; i < shape.length; i++) {
      add(new DimsData(i));
    }

    if (map.isEmpty()) { // Make one up
      getDimsData(0).setSliceRange("all");
      if (size() == 2) {
        getDimsData(1).setPlotAxis(AxisType.X);

      } else if (size() > 2) {
        getDimsData(1).setPlotAxis(AxisType.Y);
        getDimsData(2).setPlotAxis(AxisType.X);
        for (int i = 3; i < size(); i++) {
          getDimsData(i).setSlice(0);
        }
      }

    } else { // Init one from map saved

      int dim = 0;

      for (DimsData dd : iterable()) {
        String value = map.get(dd.getDimension());
        if (value == null) value = map.get(String.valueOf(dd.getDimension()));
        if (value != null) {
          if ("all".equals(value)) {
            dd.setPlotAxis(AxisType.RANGE);
            continue;
          }

          AxisType at = AxisType.forLabel(value);
          if (at != null) {
            dd.setPlotAxis(at);
            continue;
          }

          try {
            dd.setSlice(Integer.parseInt(value));
          } catch (Exception ne) {
            dd.setSliceRange(value);
          }
        } else {
          AxisType type = AxisType.forAxis(dim);
          dd.setPlotAxis(type);
          ++dim;
        }
      }
    }
  }
  public void removeLargeStacks(ISliceSystem slicingSystem, int maxStack) {

    for (DimsData dd : getDimsData()) {
      if (dd.getPlotAxis().isStack(slicingSystem)) {
        if (dd.getSliceRange(true) == null
            || "".equals(dd.getSliceRange(true))
            || "all".equals(dd.getSliceRange(true))) {
          final ILazyDataset lz = slicingSystem.getData().getLazySet();
          if (lz != null) {
            final int size = lz.getShape()[dd.getDimension()];
            if (size >= maxStack) { // We set a default slice
              dd.setSliceRange("0:25");
            }
          }
        }
      }
    }
  }