Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/26/09 11:35:26 (15 years ago)
Author:
mkommend
Message:
  • implemented GetVariableValues in dataset
  • added row number in rowheaders of dataset view

(ticket #726)

Location:
trunk/sources/HeuristicLab.DataAnalysis/3.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs

    r2310 r2311  
    147147      }
    148148      throw new ArgumentException("The variable name " + variableName + " was not found.");
     149    }
     150
     151    public double[] GetVariableValues(int variableIndex, int start, int end) {
     152      if (start < 0 || !(start <= end))
     153        throw new ArgumentException("Start must be between 0 and end (" + end + ").");
     154      if (end > rows || end < start)
     155        throw new ArgumentException("End must be between start (" + start + ") and dataset rows (" + rows + ").");
     156
     157      double[] values = new double[end - start];
     158      for (int i = 0; i < end - start; i++)
     159        values[i] = GetValue(i + start, variableIndex);
     160      return values;
     161    }
     162
     163    public double[] GetVariableValues(int variableIndex) {
     164      return GetVariableValues(variableIndex, 0, this.rows);
     165    }
     166
     167    public double[] GetVariableValues(string variableName, int start, int end) {
     168      return GetVariableValues(GetVariableIndex(variableName), start, end);
     169    }
     170
     171    public double[] GetVariableValues(string variableName) {
     172      return GetVariableValues(variableName, 0, this.rows);
    149173    }
    150174
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.cs

    r2223 r2311  
    6969        // have been updated (and their SortMode set to 'NotSortable') we switch back to SelectionMode=ColumnHeaderSelect.
    7070        dataGridView.SelectionMode = DataGridViewSelectionMode.CellSelect;
    71         dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
     71        //dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
    7272        int rows = Dataset.Rows;
    7373        int columns = Dataset.Columns;
     
    9090        }
    9191        dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect; // switch back to column selection
    92         dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
     92        //dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
    9393      } else {
    9494        rowsTextBox.Text = "1";
     
    9797        dataGridView.RowCount = 1;
    9898      }
     99      UpdateRowHeaders();
     100      this.dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
     101    }
     102
     103    private void UpdateRowHeaders() {
     104      for (int i = dataGridView.FirstDisplayedScrollingRowIndex; i < dataGridView.FirstDisplayedScrollingRowIndex + dataGridView.DisplayedRowCount(true); i++)
     105        dataGridView.Rows[i].HeaderCell.Value = i.ToString();
     106      this.dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
     107      dataGridView.Invalidate();
     108    }
     109
     110    private void dataGridView_Scroll(object sender, ScrollEventArgs e) {
     111      UpdateRowHeaders();
     112    }
     113
     114    private void dataGridView_Resize(object sender, EventArgs e) {
     115      UpdateRowHeaders();
    99116    }
    100117
     
    175192      Refresh();
    176193    }
     194
     195 
    177196  }
    178197}
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/DatasetView.designer.cs

    r1529 r2311  
    100100      this.dataGridView.Size = new System.Drawing.Size(554, 485);
    101101      this.dataGridView.TabIndex = 3;
     102      this.dataGridView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dataGridView_Scroll);
    102103      this.dataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView_CellValidating);
     104      this.dataGridView.Resize += new System.EventHandler(this.dataGridView_Resize);
    103105      //
    104106      // contextMenuStrip
     
    110112            this.originalValuesToolStripMenuItem});
    111113      this.contextMenuStrip.Name = "contextMenuStrip";
    112       this.contextMenuStrip.Size = new System.Drawing.Size(187, 92);
     114      this.contextMenuStrip.Size = new System.Drawing.Size(198, 92);
    113115      //
    114116      // scaleValuesToolStripMenuItem
    115117      //
    116118      this.scaleValuesToolStripMenuItem.Name = "scaleValuesToolStripMenuItem";
    117       this.scaleValuesToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     119      this.scaleValuesToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
    118120      this.scaleValuesToolStripMenuItem.Text = "Scale values [0..1]";
    119121      this.scaleValuesToolStripMenuItem.Click += new System.EventHandler(this.scaleValuesToolStripMenuItem_Click);
     
    122124      //
    123125      this.scaleValuesmanuallyToolStripMenuItem.Name = "scaleValuesmanuallyToolStripMenuItem";
    124       this.scaleValuesmanuallyToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     126      this.scaleValuesmanuallyToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
    125127      this.scaleValuesmanuallyToolStripMenuItem.Text = "Scale values (manually)";
    126128      this.scaleValuesmanuallyToolStripMenuItem.Click += new System.EventHandler(this.scaleValuesmanuallyToolStripMenuItem_Click);
     
    129131      //
    130132      this.showScalingToolStripMenuItem.Name = "showScalingToolStripMenuItem";
    131       this.showScalingToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     133      this.showScalingToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
    132134      this.showScalingToolStripMenuItem.Text = "Show scaling...";
    133135      this.showScalingToolStripMenuItem.Click += new System.EventHandler(this.showScalingToolStripMenuItem_Click);
     
    136138      //
    137139      this.originalValuesToolStripMenuItem.Name = "originalValuesToolStripMenuItem";
    138       this.originalValuesToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     140      this.originalValuesToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
    139141      this.originalValuesToolStripMenuItem.Text = "Unscale values";
    140142      this.originalValuesToolStripMenuItem.Click += new System.EventHandler(this.originalValuesToolStripMenuItem_Click);
Note: See TracChangeset for help on using the changeset viewer.