Changeset 6016


Ignore:
Timestamp:
04/16/11 11:48:21 (8 years ago)
Author:
abeham
Message:

#1465

  • added sorting of series to move them back and forth
    • the implementation currently is quite memory intensive in that all data rows are cloned, the collection is cleared and then they're readded in the correct order. Since the underlying collection is a collection and not a list I don't have the possibilities to insert them.
  • fixed histogram configuration
  • added a crude check if there are incompatibilities with bars
Location:
branches/histogram/HeuristicLab.Analysis.Views/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/histogram/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.Designer.cs

    r6014 r6016  
    5454      this.label3 = new System.Windows.Forms.Label();
    5555      this.commonGroupBox = new System.Windows.Forms.GroupBox();
     56      this.axisGroupBox = new System.Windows.Forms.GroupBox();
     57      this.label5 = new System.Windows.Forms.Label();
     58      this.label6 = new System.Windows.Forms.Label();
     59      this.panel1 = new System.Windows.Forms.Panel();
     60      this.yAxisSecondaryRadioButton = new System.Windows.Forms.RadioButton();
     61      this.yAxisPrimaryRadioButton = new System.Windows.Forms.RadioButton();
    5662      this.panel2 = new System.Windows.Forms.Panel();
    5763      this.xAxisPrimaryRadioButton = new System.Windows.Forms.RadioButton();
    5864      this.xAxisSecondaryRadioButton = new System.Windows.Forms.RadioButton();
    59       this.panel1 = new System.Windows.Forms.Panel();
    60       this.yAxisSecondaryRadioButton = new System.Windows.Forms.RadioButton();
    61       this.yAxisPrimaryRadioButton = new System.Windows.Forms.RadioButton();
    62       this.label6 = new System.Windows.Forms.Label();
    6365      this.histoGramGroupBox = new System.Windows.Forms.GroupBox();
    6466      this.panel3 = new System.Windows.Forms.Panel();
     
    7173      this.lineStyleComboBox = new System.Windows.Forms.ComboBox();
    7274      this.label8 = new System.Windows.Forms.Label();
    73       this.label5 = new System.Windows.Forms.Label();
    74       this.axisGroupBox = new System.Windows.Forms.GroupBox();
    7575      ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).BeginInit();
    7676      this.commonGroupBox.SuspendLayout();
     77      this.axisGroupBox.SuspendLayout();
     78      this.panel1.SuspendLayout();
    7779      this.panel2.SuspendLayout();
    78       this.panel1.SuspendLayout();
    7980      this.histoGramGroupBox.SuspendLayout();
    8081      this.panel3.SuspendLayout();
    8182      this.lineChartGroupBox.SuspendLayout();
    8283      ((System.ComponentModel.ISupportInitialize)(this.lineWidthNumericUpDown)).BeginInit();
    83       this.axisGroupBox.SuspendLayout();
    8484      this.SuspendLayout();
    8585      //
     
    180180      this.commonGroupBox.Text = "Common";
    181181      //
     182      // axisGroupBox
     183      //
     184      this.axisGroupBox.Controls.Add(this.label5);
     185      this.axisGroupBox.Controls.Add(this.label6);
     186      this.axisGroupBox.Controls.Add(this.panel1);
     187      this.axisGroupBox.Controls.Add(this.panel2);
     188      this.axisGroupBox.Location = new System.Drawing.Point(6, 75);
     189      this.axisGroupBox.Name = "axisGroupBox";
     190      this.axisGroupBox.Size = new System.Drawing.Size(299, 75);
     191      this.axisGroupBox.TabIndex = 9;
     192      this.axisGroupBox.TabStop = false;
     193      this.axisGroupBox.Text = "Display Data on";
     194      //
     195      // label5
     196      //
     197      this.label5.AutoSize = true;
     198      this.label5.Location = new System.Drawing.Point(6, 46);
     199      this.label5.Name = "label5";
     200      this.label5.Size = new System.Drawing.Size(39, 13);
     201      this.label5.TabIndex = 6;
     202      this.label5.Text = "Y Axis:";
     203      //
     204      // label6
     205      //
     206      this.label6.AutoSize = true;
     207      this.label6.Location = new System.Drawing.Point(6, 22);
     208      this.label6.Name = "label6";
     209      this.label6.Size = new System.Drawing.Size(39, 13);
     210      this.label6.TabIndex = 6;
     211      this.label6.Text = "X Axis:";
     212      //
     213      // panel1
     214      //
     215      this.panel1.Controls.Add(this.yAxisSecondaryRadioButton);
     216      this.panel1.Controls.Add(this.yAxisPrimaryRadioButton);
     217      this.panel1.Location = new System.Drawing.Point(63, 40);
     218      this.panel1.Name = "panel1";
     219      this.panel1.Size = new System.Drawing.Size(231, 25);
     220      this.panel1.TabIndex = 5;
     221      //
     222      // yAxisSecondaryRadioButton
     223      //
     224      this.yAxisSecondaryRadioButton.AutoSize = true;
     225      this.yAxisSecondaryRadioButton.Location = new System.Drawing.Point(70, 4);
     226      this.yAxisSecondaryRadioButton.Name = "yAxisSecondaryRadioButton";
     227      this.yAxisSecondaryRadioButton.Size = new System.Drawing.Size(76, 17);
     228      this.yAxisSecondaryRadioButton.TabIndex = 1;
     229      this.yAxisSecondaryRadioButton.TabStop = true;
     230      this.yAxisSecondaryRadioButton.Text = "Secondary";
     231      this.yAxisSecondaryRadioButton.UseVisualStyleBackColor = true;
     232      this.yAxisSecondaryRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
     233      //
     234      // yAxisPrimaryRadioButton
     235      //
     236      this.yAxisPrimaryRadioButton.AutoSize = true;
     237      this.yAxisPrimaryRadioButton.Location = new System.Drawing.Point(4, 4);
     238      this.yAxisPrimaryRadioButton.Name = "yAxisPrimaryRadioButton";
     239      this.yAxisPrimaryRadioButton.Size = new System.Drawing.Size(59, 17);
     240      this.yAxisPrimaryRadioButton.TabIndex = 0;
     241      this.yAxisPrimaryRadioButton.TabStop = true;
     242      this.yAxisPrimaryRadioButton.Text = "Primary";
     243      this.yAxisPrimaryRadioButton.UseVisualStyleBackColor = true;
     244      this.yAxisPrimaryRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
     245      //
    182246      // panel2
    183247      //
     
    212276      this.xAxisSecondaryRadioButton.UseVisualStyleBackColor = true;
    213277      this.xAxisSecondaryRadioButton.CheckedChanged += new System.EventHandler(this.xAxisRadioButton_CheckedChanged);
    214       //
    215       // panel1
    216       //
    217       this.panel1.Controls.Add(this.yAxisSecondaryRadioButton);
    218       this.panel1.Controls.Add(this.yAxisPrimaryRadioButton);
    219       this.panel1.Location = new System.Drawing.Point(63, 40);
    220       this.panel1.Name = "panel1";
    221       this.panel1.Size = new System.Drawing.Size(231, 25);
    222       this.panel1.TabIndex = 5;
    223       //
    224       // yAxisSecondaryRadioButton
    225       //
    226       this.yAxisSecondaryRadioButton.AutoSize = true;
    227       this.yAxisSecondaryRadioButton.Location = new System.Drawing.Point(70, 4);
    228       this.yAxisSecondaryRadioButton.Name = "yAxisSecondaryRadioButton";
    229       this.yAxisSecondaryRadioButton.Size = new System.Drawing.Size(76, 17);
    230       this.yAxisSecondaryRadioButton.TabIndex = 1;
    231       this.yAxisSecondaryRadioButton.TabStop = true;
    232       this.yAxisSecondaryRadioButton.Text = "Secondary";
    233       this.yAxisSecondaryRadioButton.UseVisualStyleBackColor = true;
    234       this.yAxisSecondaryRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
    235       //
    236       // yAxisPrimaryRadioButton
    237       //
    238       this.yAxisPrimaryRadioButton.AutoSize = true;
    239       this.yAxisPrimaryRadioButton.Location = new System.Drawing.Point(4, 4);
    240       this.yAxisPrimaryRadioButton.Name = "yAxisPrimaryRadioButton";
    241       this.yAxisPrimaryRadioButton.Size = new System.Drawing.Size(59, 17);
    242       this.yAxisPrimaryRadioButton.TabIndex = 0;
    243       this.yAxisPrimaryRadioButton.TabStop = true;
    244       this.yAxisPrimaryRadioButton.Text = "Primary";
    245       this.yAxisPrimaryRadioButton.UseVisualStyleBackColor = true;
    246       this.yAxisPrimaryRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
    247       //
    248       // label6
    249       //
    250       this.label6.AutoSize = true;
    251       this.label6.Location = new System.Drawing.Point(6, 22);
    252       this.label6.Name = "label6";
    253       this.label6.Size = new System.Drawing.Size(39, 13);
    254       this.label6.TabIndex = 6;
    255       this.label6.Text = "X Axis:";
    256278      //
    257279      // histoGramGroupBox
     
    288310      this.binsApproximatelyRadioButton.Text = "Approximately";
    289311      this.binsApproximatelyRadioButton.UseVisualStyleBackColor = true;
    290       this.binsApproximatelyRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
     312      this.binsApproximatelyRadioButton.CheckedChanged += new System.EventHandler(this.binNumberRadioButton_CheckedChanged);
    291313      //
    292314      // binsExactRadioButton
     
    300322      this.binsExactRadioButton.Text = "Exact";
    301323      this.binsExactRadioButton.UseVisualStyleBackColor = true;
    302       this.binsExactRadioButton.CheckedChanged += new System.EventHandler(this.yAxisRadioButton_CheckedChanged);
     324      this.binsExactRadioButton.CheckedChanged += new System.EventHandler(this.binNumberRadioButton_CheckedChanged);
    303325      //
    304326      // lineChartGroupBox
     
    374396      this.label8.Text = "Line Style:";
    375397      //
    376       // label5
    377       //
    378       this.label5.AutoSize = true;
    379       this.label5.Location = new System.Drawing.Point(6, 46);
    380       this.label5.Name = "label5";
    381       this.label5.Size = new System.Drawing.Size(39, 13);
    382       this.label5.TabIndex = 6;
    383       this.label5.Text = "Y Axis:";
    384       //
    385       // axisGroupBox
    386       //
    387       this.axisGroupBox.Controls.Add(this.label5);
    388       this.axisGroupBox.Controls.Add(this.label6);
    389       this.axisGroupBox.Controls.Add(this.panel1);
    390       this.axisGroupBox.Controls.Add(this.panel2);
    391       this.axisGroupBox.Location = new System.Drawing.Point(6, 75);
    392       this.axisGroupBox.Name = "axisGroupBox";
    393       this.axisGroupBox.Size = new System.Drawing.Size(299, 75);
    394       this.axisGroupBox.TabIndex = 9;
    395       this.axisGroupBox.TabStop = false;
    396       this.axisGroupBox.Text = "Display Data on";
    397       //
    398398      // DataRowVisualPropertiesControl
    399399      //
     
    408408      this.commonGroupBox.ResumeLayout(false);
    409409      this.commonGroupBox.PerformLayout();
     410      this.axisGroupBox.ResumeLayout(false);
     411      this.axisGroupBox.PerformLayout();
     412      this.panel1.ResumeLayout(false);
     413      this.panel1.PerformLayout();
    410414      this.panel2.ResumeLayout(false);
    411415      this.panel2.PerformLayout();
    412       this.panel1.ResumeLayout(false);
    413       this.panel1.PerformLayout();
    414416      this.histoGramGroupBox.ResumeLayout(false);
    415417      this.histoGramGroupBox.PerformLayout();
     
    419421      this.lineChartGroupBox.PerformLayout();
    420422      ((System.ComponentModel.ISupportInitialize)(this.lineWidthNumericUpDown)).EndInit();
    421       this.axisGroupBox.ResumeLayout(false);
    422       this.axisGroupBox.PerformLayout();
    423423      this.ResumeLayout(false);
    424424
  • branches/histogram/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.cs

    r6014 r6016  
    9797    private void chartTypeComboBox_SelectedValueChanged(object sender, EventArgs e) {
    9898      if (!SuppressEvents && Content != null) {
    99         Content.ChartType = (DataRowVisualProperties.DataRowChartType)chartTypeComboBox.SelectedValue;
     99        DataRowVisualProperties.DataRowChartType selected = (DataRowVisualProperties.DataRowChartType)chartTypeComboBox.SelectedValue;
     100        Content.ChartType = selected;
     101        if (Content.ChartType != selected) {
     102          MessageBox.Show("There may be incompatibilities with other series or the data is not suited to be displayed as " + selected.ToString() + ".", "Failed to set type to " + selected.ToString());
     103          SuppressEvents = true;
     104          try {
     105            chartTypeComboBox.SelectedItem = Content.ChartType;
     106          } finally { SuppressEvents = false; }
     107        }
    100108        SetEnabledStateOfControls();
    101109      }
     
    156164        SuppressEvents = true;
    157165        try {
    158           if (sender == binsApproximatelyRadioButton)
    159             binsExactRadioButton.Checked = !binsApproximatelyRadioButton.Checked;
    160           else binsApproximatelyRadioButton.Checked = !binsExactRadioButton.Checked;
    161166          Content.ExactBins = binsExactRadioButton.Checked;
    162167        } finally { SuppressEvents = false; }
  • branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r6015 r6016  
    172172          break;
    173173        case DataRowVisualProperties.DataRowChartType.Bars:
    174           series.ChartType = SeriesChartType.Bar;
     174          if (!chart.Series.Any(x => x.ChartType != SeriesChartType.Bar && x.ChartType != SeriesChartType.StackedBar && x.ChartType != SeriesChartType.StackedBar100))
     175            series.ChartType = SeriesChartType.Bar;
     176          else {
     177            series.ChartType = SeriesChartType.FastPoint; //default
     178            row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Points;
     179          }
    175180          break;
    176181        case DataRowVisualProperties.DataRowChartType.Columns:
     
    179184        case DataRowVisualProperties.DataRowChartType.Points:
    180185          series.ChartType = SeriesChartType.FastPoint;
    181           series.BorderWidth = row.VisualProperties.LineWidth;
    182           series.BorderDashStyle = ConvertLineStyle(row.VisualProperties.LineStyle);
    183186          break;
    184187        case DataRowVisualProperties.DataRowChartType.Histogram:
  • branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r6014 r6016  
    5151      this.splitContainer = new System.Windows.Forms.SplitContainer();
    5252      this.seriesListView = new System.Windows.Forms.ListView();
     53      this.dataRowVisualPropertiesControl = new HeuristicLab.Analysis.Views.DataRowVisualPropertiesControl();
    5354      this.chartTabPage = new System.Windows.Forms.TabPage();
    54       this.dataRowVisualPropertiesControl = new HeuristicLab.Analysis.Views.DataRowVisualPropertiesControl();
    5555      this.dataTableVisualPropertiesControl = new HeuristicLab.Analysis.Views.DataTableVisualPropertiesControl();
     56      this.upButton = new System.Windows.Forms.Button();
     57      this.downButton = new System.Windows.Forms.Button();
    5658      this.tabControl.SuspendLayout();
    5759      this.seriesTabPage.SuspendLayout();
     
    120122      // splitContainer.Panel1
    121123      //
     124      this.splitContainer.Panel1.Controls.Add(this.downButton);
     125      this.splitContainer.Panel1.Controls.Add(this.upButton);
    122126      this.splitContainer.Panel1.Controls.Add(this.seriesListView);
    123127      this.splitContainer.Panel1MinSize = 20;
     
    133137      // seriesListView
    134138      //
    135       this.seriesListView.Dock = System.Windows.Forms.DockStyle.Fill;
     139      this.seriesListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     140                  | System.Windows.Forms.AnchorStyles.Left)
     141                  | System.Windows.Forms.AnchorStyles.Right)));
    136142      this.seriesListView.HideSelection = false;
    137       this.seriesListView.Location = new System.Drawing.Point(0, 0);
     143      this.seriesListView.Location = new System.Drawing.Point(0, 28);
    138144      this.seriesListView.MultiSelect = false;
    139145      this.seriesListView.Name = "seriesListView";
    140146      this.seriesListView.ShowGroups = false;
    141       this.seriesListView.Size = new System.Drawing.Size(125, 318);
     147      this.seriesListView.Size = new System.Drawing.Size(125, 289);
    142148      this.seriesListView.TabIndex = 0;
    143149      this.seriesListView.UseCompatibleStateImageBehavior = false;
    144150      this.seriesListView.View = System.Windows.Forms.View.SmallIcon;
    145151      this.seriesListView.SelectedIndexChanged += new System.EventHandler(this.seriesListView_SelectedIndexChanged);
     152      //
     153      // dataRowVisualPropertiesControl
     154      //
     155      this.dataRowVisualPropertiesControl.Content = null;
     156      this.dataRowVisualPropertiesControl.Dock = System.Windows.Forms.DockStyle.Fill;
     157      this.dataRowVisualPropertiesControl.Location = new System.Drawing.Point(0, 0);
     158      this.dataRowVisualPropertiesControl.Name = "dataRowVisualPropertiesControl";
     159      this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(331, 318);
     160      this.dataRowVisualPropertiesControl.TabIndex = 0;
    146161      //
    147162      // chartTabPage
     
    156171      this.chartTabPage.UseVisualStyleBackColor = true;
    157172      //
    158       // dataRowVisualPropertiesControl
    159       //
    160       this.dataRowVisualPropertiesControl.Content = null;
    161       this.dataRowVisualPropertiesControl.Dock = System.Windows.Forms.DockStyle.Fill;
    162       this.dataRowVisualPropertiesControl.Location = new System.Drawing.Point(0, 0);
    163       this.dataRowVisualPropertiesControl.Name = "dataRowVisualPropertiesControl";
    164       this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(331, 318);
    165       this.dataRowVisualPropertiesControl.TabIndex = 0;
    166       //
    167173      // dataTableVisualPropertiesControl
    168174      //
     
    173179      this.dataTableVisualPropertiesControl.Size = new System.Drawing.Size(460, 318);
    174180      this.dataTableVisualPropertiesControl.TabIndex = 0;
     181      //
     182      // upButton
     183      //
     184      this.upButton.Location = new System.Drawing.Point(-1, 3);
     185      this.upButton.Name = "upButton";
     186      this.upButton.Size = new System.Drawing.Size(26, 23);
     187      this.upButton.TabIndex = 1;
     188      this.upButton.Text = "Up";
     189      this.upButton.UseVisualStyleBackColor = true;
     190      this.upButton.Click += new System.EventHandler(this.upButton_Click);
     191      //
     192      // downButton
     193      //
     194      this.downButton.Location = new System.Drawing.Point(27, 3);
     195      this.downButton.Name = "downButton";
     196      this.downButton.Size = new System.Drawing.Size(26, 23);
     197      this.downButton.TabIndex = 1;
     198      this.downButton.Text = "Down";
     199      this.downButton.UseVisualStyleBackColor = true;
     200      this.downButton.Click += new System.EventHandler(this.downButton_Click);
    175201      //
    176202      // DataTableVisualPropertiesDialog
     
    208234    private DataRowVisualPropertiesControl dataRowVisualPropertiesControl;
    209235    private DataTableVisualPropertiesControl dataTableVisualPropertiesControl;
     236    private System.Windows.Forms.Button downButton;
     237    private System.Windows.Forms.Button upButton;
    210238  }
    211239}
  • branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r6012 r6016  
    2323using System.Windows.Forms;
    2424using HeuristicLab.Common.Resources;
     25using HeuristicLab.Core;
    2526
    2627namespace HeuristicLab.Analysis.Views {
     
    3233    public DataTableVisualPropertiesDialog(DataTable dataTable) {
    3334      InitializeComponent();
     35      upButton.Text = string.Empty;
     36      upButton.Image = VSImageLibrary.ArrowUp;
     37      downButton.Text = string.Empty;
     38      downButton.Image = VSImageLibrary.ArrowDown;
    3439      Content = dataTable;
    3540      originalDataTableVPs = (DataTableVisualProperties)Content.VisualProperties.Clone();
     
    7176      Close();
    7277    }
     78
     79    private void upButton_Click(object sender, System.EventArgs e) {
     80      if (seriesListView.SelectedIndices.Count == 1 && seriesListView.SelectedIndices[0] > 0) {
     81        int index = seriesListView.SelectedIndices[0];
     82        seriesListView.BeginUpdate();
     83        ListViewItem selectedSeriesItem = seriesListView.Items[index];
     84        seriesListView.Items.RemoveAt(index);
     85        ListViewItem temp = seriesListView.Items[index - 1];
     86        seriesListView.Items.RemoveAt(index - 1);
     87        seriesListView.Items.Insert(index - 1, selectedSeriesItem);
     88        seriesListView.Items.Insert(index, temp);
     89        seriesListView.EndUpdate();
     90        UpdateAllSeriesPositions();
     91      }
     92    }
     93
     94    private void downButton_Click(object sender, System.EventArgs e) {
     95      if (seriesListView.SelectedIndices.Count == 1 && seriesListView.SelectedIndices[0] < seriesListView.Items.Count - 1) {
     96        int index = seriesListView.SelectedIndices[0];
     97        seriesListView.BeginUpdate();
     98        ListViewItem temp = seriesListView.Items[index + 1];
     99        seriesListView.Items.RemoveAt(index + 1);
     100        ListViewItem selectedSeriesItem = seriesListView.Items[index];
     101        seriesListView.Items.RemoveAt(index);
     102        seriesListView.Items.Insert(index, temp);
     103        seriesListView.Items.Insert(index + 1, selectedSeriesItem);
     104        seriesListView.EndUpdate();
     105        UpdateAllSeriesPositions();
     106      }
     107    }
     108
     109    #region Helpers
     110    private void UpdateAllSeriesPositions() {
     111      NamedItemCollection<DataRow> rows = (NamedItemCollection<DataRow>)Content.Rows.Clone();
     112      Content.Rows.Clear();
     113      for (int i = 0; i < seriesListView.Items.Count; i++) {
     114        ListViewItem item = seriesListView.Items[i];
     115        Content.Rows.Add(rows[item.Text]);
     116      }
     117    }
     118    #endregion
    73119  }
    74120}
Note: See TracChangeset for help on using the changeset viewer.