public AbstractEnvelopeReportPieCanvas(Composite parent, final DateRangeCombo combo, int style) {
    super(parent, combo, style);

    transactionService.addEntityListener(this);

    topEnvelopeSource = getInitialEnvelopeSource();
    envelopeStack.push(topEnvelopeSource);

    addKeyListener(
        new KeyAdapter() {

          public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.ESC) {
              if (envelopeStack.size() > 1) {
                popSourceEnvelope();
                regenerateChart();
              }
            }
          }
        });
  }
  protected DataSetResult createDataSet(boolean expense) {
    double maxSum = 0.0;
    double minSum = Double.MAX_VALUE;
    List<EnvelopeResult> dataSet = new LinkedList<EnvelopeResult>();

    EnvelopeSource envelopeSource = envelopeStack.peek();
    List<Envelope> envelopes = new LinkedList<Envelope>();
    /*
     * if (envelopeSource.getEnvelope() != null) {
     * envelopes.add(envelopeSource.getEnvelope()); }
     */
    envelopes.addAll(envelopeSource.getAvailableEnvelopes());

    List<InternalTransaction> allTransactions = new LinkedList<InternalTransaction>();

    if (envelopeSource.getEnvelope() != null) {
      EnvelopeResult result =
          calculateResult(envelopeSource.getEnvelope(), expense, false, allTransactions);
      maxSum = Math.max(result.getValue(), maxSum);
      minSum = Math.min(result.getValue(), minSum);
      dataSet.add(result);
    }

    for (Envelope env : envelopes) {
      if (env != envelopeSource.getEnvelope()) {
        EnvelopeResult result = calculateResult(env, expense, true, allTransactions);
        maxSum = Math.max(result.getValue(), maxSum);
        minSum = Math.min(result.getValue(), minSum);
        dataSet.add(result);
      }
    }

    Collections.sort(dataSet);

    double allOtherTotal = 0.0;

    EnvelopeResult remaining = null;
    int count = 0;

    for (int i = dataSet.size() - 1; i >= 5; i--) {
      EnvelopeResult result = dataSet.get(i);
      if (result.getValue() > 0) {
        count++;
        remaining = result;
      }
      allOtherTotal += result.getValue();
      dataSet.remove(i);
    }

    if (count == 1) {
      dataSet.add(remaining);
      allOtherTotal = 0.0;
    }

    // remove any zero valued categories
    for (int i = dataSet.size() - 1; i >= 0; i--) {
      EnvelopeResult result = dataSet.get(i);
      if (result.getValue() == 0.0) {
        dataSet.remove(i);
      }
    }

    transactionService.setCustomTransactionList(allTransactions);

    result = new EnvelopeDataSetResult(dataSet, allOtherTotal, minSum, maxSum);
    return result;
  }