Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4709


Ignore:
Timestamp:
11/02/10 15:30:42 (13 years ago)
Author:
mkommend
Message:

Added StatusStrip in StringConvertibleMatrixView to diplay statistical information (ticket #1253).

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.Designer.cs

    r4477 r4709  
    5454      this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
    5555      this.ShowHideColumns = new System.Windows.Forms.ToolStripMenuItem();
     56      this.statusStrip = new System.Windows.Forms.StatusStrip();
     57      this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
    5658      ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
    5759      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5860      this.contextMenu.SuspendLayout();
     61      this.statusStrip.SuspendLayout();
    5962      this.SuspendLayout();
    6063      //
     
    9396      this.dataGridView.Name = "dataGridView";
    9497      this.dataGridView.RowHeadersWidth = 160;
    95       this.dataGridView.Size = new System.Drawing.Size(424, 352);
     98      this.dataGridView.Size = new System.Drawing.Size(424, 327);
    9699      this.dataGridView.TabIndex = 4;
    97100      this.dataGridView.VirtualMode = true;
     
    102105      this.dataGridView.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView_ColumnHeaderMouseClick);
    103106      this.dataGridView.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dataGridView_Scroll);
     107      this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged);
    104108      this.dataGridView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView_KeyDown);
    105       this.dataGridView.MouseClick += new System.Windows.Forms.MouseEventHandler(dataGridView_MouseClick);
     109      this.dataGridView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridView_MouseClick);
    106110      this.dataGridView.Resize += new System.EventHandler(this.dataGridView_Resize);
    107111      //
     
    146150      this.ShowHideColumns.Click += new System.EventHandler(this.ShowHideColumns_Click);
    147151      //
     152      // statusStrip1
     153      //
     154      this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     155            this.toolStripStatusLabel});
     156      this.statusStrip.Location = new System.Drawing.Point(0, 382);
     157      this.statusStrip.Name = "statusStrip1";
     158      this.statusStrip.Size = new System.Drawing.Size(424, 22);
     159      this.statusStrip.TabIndex = 5;
     160      this.statusStrip.Text = "statusStrip1";
     161      //
     162      // toolStripStatusLabel
     163      //
     164      this.toolStripStatusLabel.Name = "toolStripStatusLabel";
     165      this.toolStripStatusLabel.Size = new System.Drawing.Size(378, 17);
     166      this.toolStripStatusLabel.Spring = true;
     167      //
    148168      // StringConvertibleMatrixView
    149169      //
    150170      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    151171      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     172      this.Controls.Add(this.statusStrip);
    152173      this.Controls.Add(this.dataGridView);
    153174      this.Controls.Add(this.columnsTextBox);
     
    160181      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    161182      this.contextMenu.ResumeLayout(false);
     183      this.statusStrip.ResumeLayout(false);
     184      this.statusStrip.PerformLayout();
    162185      this.ResumeLayout(false);
    163186      this.PerformLayout();
     
    174197    protected System.Windows.Forms.ToolStripMenuItem ShowHideColumns;
    175198    protected System.Windows.Forms.DataGridView dataGridView;
     199    private System.Windows.Forms.StatusStrip statusStrip;
     200    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel;
    176201
    177202  }
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r4707 r4709  
    5656      get { return showRowsAndColumnsTextBox; }
    5757      set {
    58         if (value != showRowsAndColumnsTextBox) {
    59           showRowsAndColumnsTextBox = value;
    60           UpdateVisibilityOfTextBoxes();
    61         }
     58        showRowsAndColumnsTextBox = value;
     59        UpdateVisibilityOfTextBoxes();
     60      }
     61    }
     62
     63    private bool showStatisticalInformation;
     64    public bool ShowStatisticalInformation {
     65      get { return showStatisticalInformation; }
     66      set {
     67        showStatisticalInformation = value;
     68        UpdateVisibilityOfStatisticalInformation();
    6269      }
    6370    }
     
    6572    public StringConvertibleMatrixView() {
    6673      InitializeComponent();
    67       showRowsAndColumnsTextBox = true;
     74      ShowRowsAndColumnsTextBox = true;
     75      ShowStatisticalInformation = false;
    6876      errorProvider.SetIconAlignment(rowsTextBox, ErrorIconAlignment.MiddleLeft);
    6977      errorProvider.SetIconPadding(rowsTextBox, 2);
     
    496504      rowsTextBox.Visible = columnsTextBox.Visible = showRowsAndColumnsTextBox;
    497505      rowsLabel.Visible = columnsLabel.Visible = showRowsAndColumnsTextBox;
    498 
     506      UpdateDataGridViewSizeAndLocation();
     507    }
     508
     509    private void UpdateVisibilityOfStatisticalInformation() {
     510      statusStrip.Visible = showStatisticalInformation;
     511      UpdateDataGridViewSizeAndLocation();
     512    }
     513
     514    private void UpdateDataGridViewSizeAndLocation() {
    499515      int headerSize = columnsTextBox.Location.Y + columnsTextBox.Size.Height +
    500         columnsTextBox.Margin.Bottom + dataGridView.Margin.Top;
     516       columnsTextBox.Margin.Bottom + dataGridView.Margin.Top;
    501517
    502518      int offset = showRowsAndColumnsTextBox ? headerSize : 0;
    503519      dataGridView.Location = new Point(0, offset);
    504       dataGridView.Size = new Size(Size.Width, Size.Height - offset);
     520
     521      int statusStripHeight = showStatisticalInformation ? statusStrip.Height : 0;
     522      dataGridView.Size = new Size(Size.Width, Size.Height - offset - statusStripHeight);
     523    }
     524
     525    private void dataGridView_SelectionChanged(object sender, EventArgs e) {
     526      toolStripStatusLabel.Text = string.Empty;
     527      if (dataGridView.SelectedCells.Count > 1) {
     528        List<double> selectedValues = new List<double>();
     529        foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
     530          double value;
     531          if (!double.TryParse(cell.Value.ToString(), out value)) return;
     532          selectedValues.Add(value);
     533        }
     534        if (selectedValues.Count > 1) {
     535          StringBuilder labelText = new StringBuilder();
     536          labelText.Append("Average: " + selectedValues.Average() + "    ");
     537          labelText.Append("StdDev: " + selectedValues.StandardDeviation() + "    ");
     538          labelText.Append("Sum: " + selectedValues.Sum() + "    ");
     539          labelText.Append("Count: " + selectedValues.Count + "    ");
     540          toolStripStatusLabel.Text = labelText.ToString();
     541        }
     542      }
    505543    }
    506544  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBoxPlotView.Designer.cs

    r4653 r4709  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    49       System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
     48      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
     49      System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
    5050      this.xAxisLabel = new System.Windows.Forms.Label();
    5151      this.xAxisComboBox = new System.Windows.Forms.ComboBox();
     
    5656      this.splitContainer = new System.Windows.Forms.SplitContainer();
    5757      this.statisticsGroupBox = new System.Windows.Forms.GroupBox();
     58      this.tooltip = new System.Windows.Forms.ToolTip(this.components);
    5859      this.statisticsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    59       this.tooltip = new System.Windows.Forms.ToolTip(this.components);
    6060      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    6161      this.splitContainer.Panel1.SuspendLayout();
     
    112112                  | System.Windows.Forms.AnchorStyles.Left)
    113113                  | System.Windows.Forms.AnchorStyles.Right)));
    114       chartArea1.Name = "ChartArea1";
    115       this.chart.ChartAreas.Add(chartArea1);
     114      chartArea2.Name = "ChartArea1";
     115      this.chart.ChartAreas.Add(chartArea2);
    116116      this.chart.Location = new System.Drawing.Point(6, 30);
    117117      this.chart.Name = "chart";
    118       series1.ChartArea = "ChartArea1";
    119       series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.BoxPlot;
    120       series1.IsVisibleInLegend = false;
    121       series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
    122       series1.Name = "DataSeries";
    123       series1.YValuesPerPoint = 6;
    124       this.chart.Series.Add(series1);
     118      series2.ChartArea = "ChartArea1";
     119      series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.BoxPlot;
     120      series2.IsVisibleInLegend = false;
     121      series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
     122      series2.Name = "DataSeries";
     123      series2.YValuesPerPoint = 6;
     124      this.chart.Series.Add(series2);
    125125      this.chart.Size = new System.Drawing.Size(534, 217);
    126126      this.chart.TabIndex = 17;
     
    184184      this.statisticsMatrixView.ReadOnly = true;
    185185      this.statisticsMatrixView.ShowRowsAndColumnsTextBox = false;
     186      this.statisticsMatrixView.ShowStatisticalInformation = false;
    186187      this.statisticsMatrixView.Size = new System.Drawing.Size(528, 110);
    187188      this.statisticsMatrixView.TabIndex = 0;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.Designer.cs

    r4200 r4709  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.components = new System.ComponentModel.Container();
    48       this.dataGridView.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(dataGridView_RowHeaderMouseDoubleClick);
     47      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     48      this.SuspendLayout();
     49      //
     50      // rowsTextBox
     51      //
     52      this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     53      this.errorProvider.SetIconPadding(this.rowsTextBox, 2);
     54      //
     55      // RunCollectionTabularView
     56      //
     57      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     58      this.Name = "RunCollectionTabularView";
     59      this.ShowStatisticalInformation = true;
     60      this.Controls.SetChildIndex(this.rowsLabel, 0);
     61      this.Controls.SetChildIndex(this.columnsLabel, 0);
     62      this.Controls.SetChildIndex(this.rowsTextBox, 0);
     63      this.Controls.SetChildIndex(this.columnsTextBox, 0);
     64      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     65      this.ResumeLayout(false);
     66      this.PerformLayout();
     67
    4968    }
    5069
Note: See TracChangeset for help on using the changeset viewer.