Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14589


Ignore:
Timestamp:
01/20/17 09:55:38 (7 years ago)
Author:
gkronber
Message:

#2650 merged r14548:14582 from trunk to to branch

Location:
branches/symbreg-factors-2650
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650

  • branches/symbreg-factors-2650/HeuristicLab.Analysis

  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views

  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.Designer.cs

    r14449 r14589  
    5454      this.label3 = new System.Windows.Forms.Label();
    5555      this.commonGroupBox = new System.Windows.Forms.GroupBox();
     56      this.clearColorButton = new System.Windows.Forms.Button();
    5657      this.isVisibleInLegendCheckBox = new System.Windows.Forms.CheckBox();
    5758      this.label10 = new System.Windows.Forms.Label();
     
    7071      this.binsExactRadioButton = new System.Windows.Forms.RadioButton();
    7172      this.binsApproximatelyRadioButton = new System.Windows.Forms.RadioButton();
     73      this.label11 = new System.Windows.Forms.Label();
     74      this.aggregationComboBox = new System.Windows.Forms.ComboBox();
    7275      this.lineChartGroupBox = new System.Windows.Forms.GroupBox();
    7376      this.lineWidthNumericUpDown = new System.Windows.Forms.NumericUpDown();
     
    8891      // chartTypeComboBox
    8992      //
    90       this.chartTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     93      this.chartTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    9194            | System.Windows.Forms.AnchorStyles.Right)));
    9295      this.chartTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    125128      // binsNumericUpDown
    126129      //
    127       this.binsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    128             | System.Windows.Forms.AnchorStyles.Right)));
    129       this.binsNumericUpDown.Location = new System.Drawing.Point(57, 19);
     130      this.binsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     131            | System.Windows.Forms.AnchorStyles.Right)));
     132      this.binsNumericUpDown.Location = new System.Drawing.Point(82, 19);
    130133      this.binsNumericUpDown.Minimum = new decimal(new int[] {
    131134            1,
     
    134137            0});
    135138      this.binsNumericUpDown.Name = "binsNumericUpDown";
    136       this.binsNumericUpDown.Size = new System.Drawing.Size(97, 20);
     139      this.binsNumericUpDown.Size = new System.Drawing.Size(72, 20);
    137140      this.binsNumericUpDown.TabIndex = 1;
    138141      this.binsNumericUpDown.Value = new decimal(new int[] {
     
    172175      // commonGroupBox
    173176      //
    174       this.commonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    175             | System.Windows.Forms.AnchorStyles.Right)));
     177      this.commonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     178            | System.Windows.Forms.AnchorStyles.Right)));
     179      this.commonGroupBox.Controls.Add(this.clearColorButton);
    176180      this.commonGroupBox.Controls.Add(this.isVisibleInLegendCheckBox);
    177181      this.commonGroupBox.Controls.Add(this.label10);
     
    190194      this.commonGroupBox.Text = "Common";
    191195      //
     196      // clearColorButton
     197      //
     198      this.clearColorButton.BackColor = System.Drawing.SystemColors.ActiveCaption;
     199      this.clearColorButton.Cursor = System.Windows.Forms.Cursors.Default;
     200      this.clearColorButton.FlatAppearance.BorderSize = 0;
     201      this.clearColorButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     202      this.clearColorButton.ForeColor = System.Drawing.Color.Transparent;
     203      this.clearColorButton.Location = new System.Drawing.Point(128, 76);
     204      this.clearColorButton.Margin = new System.Windows.Forms.Padding(0);
     205      this.clearColorButton.Name = "clearColorButton";
     206      this.clearColorButton.Size = new System.Drawing.Size(15, 16);
     207      this.clearColorButton.TabIndex = 10;
     208      this.clearColorButton.TabStop = false;
     209      this.clearColorButton.UseVisualStyleBackColor = false;
     210      this.clearColorButton.Click += new System.EventHandler(this.clearColorButton_Click);
     211      //
    192212      // isVisibleInLegendCheckBox
    193213      //
     
    212232      // displayNameTextBox
    213233      //
    214       this.displayNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     234      this.displayNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    215235            | System.Windows.Forms.AnchorStyles.Right)));
    216236      this.displayNameTextBox.Location = new System.Drawing.Point(102, 19);
     
    222242      // axisGroupBox
    223243      //
    224       this.axisGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    225             | System.Windows.Forms.AnchorStyles.Left) 
     244      this.axisGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     245            | System.Windows.Forms.AnchorStyles.Left)
    226246            | System.Windows.Forms.AnchorStyles.Right)));
    227247      this.axisGroupBox.Controls.Add(this.panel2);
     
    238258      // panel2
    239259      //
    240       this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     260      this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    241261            | System.Windows.Forms.AnchorStyles.Right)));
    242262      this.panel2.Controls.Add(this.yAxisSecondaryRadioButton);
     
    273293      // panel1
    274294      //
    275       this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     295      this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    276296            | System.Windows.Forms.AnchorStyles.Right)));
    277297      this.panel1.Controls.Add(this.xAxisPrimaryRadioButton);
     
    335355      // histoGramGroupBox
    336356      //
    337       this.histoGramGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     357      this.histoGramGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    338358            | System.Windows.Forms.AnchorStyles.Right)));
    339359      this.histoGramGroupBox.Controls.Add(this.binsExactRadioButton);
    340360      this.histoGramGroupBox.Controls.Add(this.binsApproximatelyRadioButton);
    341361      this.histoGramGroupBox.Controls.Add(this.binsNumericUpDown);
     362      this.histoGramGroupBox.Controls.Add(this.label11);
    342363      this.histoGramGroupBox.Controls.Add(this.label3);
     364      this.histoGramGroupBox.Controls.Add(this.aggregationComboBox);
    343365      this.histoGramGroupBox.Location = new System.Drawing.Point(0, 305);
    344366      this.histoGramGroupBox.Name = "histoGramGroupBox";
    345       this.histoGramGroupBox.Size = new System.Drawing.Size(327, 47);
     367      this.histoGramGroupBox.Size = new System.Drawing.Size(327, 75);
    346368      this.histoGramGroupBox.TabIndex = 2;
    347369      this.histoGramGroupBox.TabStop = false;
     
    374396      this.binsApproximatelyRadioButton.CheckedChanged += new System.EventHandler(this.binNumberRadioButton_CheckedChanged);
    375397      //
     398      // label11
     399      //
     400      this.label11.AutoSize = true;
     401      this.label11.Location = new System.Drawing.Point(6, 49);
     402      this.label11.Name = "label11";
     403      this.label11.Size = new System.Drawing.Size(67, 13);
     404      this.label11.TabIndex = 0;
     405      this.label11.Text = "Aggregation:";
     406      //
     407      // aggregationComboBox
     408      //
     409      this.aggregationComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     410            | System.Windows.Forms.AnchorStyles.Right)));
     411      this.aggregationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     412      this.aggregationComboBox.FormattingEnabled = true;
     413      this.aggregationComboBox.Location = new System.Drawing.Point(82, 45);
     414      this.aggregationComboBox.Name = "aggregationComboBox";
     415      this.aggregationComboBox.Size = new System.Drawing.Size(239, 21);
     416      this.aggregationComboBox.TabIndex = 3;
     417      this.aggregationComboBox.SelectedValueChanged += new System.EventHandler(this.aggregationComboBox_SelectedValueChanged);
     418      //
    376419      // lineChartGroupBox
    377420      //
    378       this.lineChartGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     421      this.lineChartGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    379422            | System.Windows.Forms.AnchorStyles.Right)));
    380423      this.lineChartGroupBox.Controls.Add(this.lineWidthNumericUpDown);
     
    393436      // lineWidthNumericUpDown
    394437      //
    395       this.lineWidthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     438      this.lineWidthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    396439            | System.Windows.Forms.AnchorStyles.Right)));
    397440      this.lineWidthNumericUpDown.Location = new System.Drawing.Point(82, 66);
     
    431474      // lineStyleComboBox
    432475      //
    433       this.lineStyleComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     476      this.lineStyleComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    434477            | System.Windows.Forms.AnchorStyles.Right)));
    435478      this.lineStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    457500      this.Controls.Add(this.commonGroupBox);
    458501      this.Name = "DataRowVisualPropertiesControl";
    459       this.Size = new System.Drawing.Size(327, 356);
     502      this.Size = new System.Drawing.Size(327, 382);
    460503      ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).EndInit();
    461504      this.commonGroupBox.ResumeLayout(false);
     
    509552    private System.Windows.Forms.Label label10;
    510553    private System.Windows.Forms.CheckBox isVisibleInLegendCheckBox;
     554    private System.Windows.Forms.Label label11;
     555    private System.Windows.Forms.ComboBox aggregationComboBox;
     556    private System.Windows.Forms.Button clearColorButton;
    511557  }
    512558}
  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.cs

    r14449 r14589  
    2323using System.Drawing;
    2424using System.Windows.Forms;
     25using HeuristicLab.Common.Resources;
    2526using HeuristicLab.MainForm;
    2627using HeuristicLab.MainForm.WindowsForms;
     
    4546      chartTypeComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowChartType));
    4647      lineStyleComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowLineStyle));
     48      aggregationComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowHistogramAggregation));
     49      clearColorButton.BackColor = Color.Transparent;
     50      clearColorButton.BackgroundImage = VSImageLibrary.Delete;
    4751      SetEnabledStateOfControls();
    4852    }
     
    6569          binsApproximatelyRadioButton.Checked = false;
    6670          binsExactRadioButton.Checked = false;
     71          aggregationComboBox.SelectedIndex = -1;
    6772          displayNameTextBox.Text = String.Empty;
    6873        } else {
     
    9398          binsApproximatelyRadioButton.Checked = !Content.ExactBins;
    9499          binsExactRadioButton.Checked = Content.ExactBins;
     100          aggregationComboBox.SelectedItem = Content.Aggregation;
    95101          displayNameTextBox.Text = Content.DisplayName;
    96102          isVisibleInLegendCheckBox.Checked = Content.IsVisibleInLegend;
     
    102108    protected virtual void SetEnabledStateOfControls() {
    103109      commonGroupBox.Enabled = Content != null;
     110      clearColorButton.Visible = Content != null && !Content.Color.IsEmpty;
    104111      lineChartGroupBox.Enabled = Content != null && Content.ChartType == DataRowVisualProperties.DataRowChartType.Line;
    105112      histoGramGroupBox.Enabled = Content != null && Content.ChartType == DataRowVisualProperties.DataRowChartType.Histogram;
     
    128135        colorButton.BackColor = Content.Color;
    129136        colorButton.Text = String.Empty;
     137        clearColorButton.Visible = true;
     138      }
     139    }
     140
     141    private void clearColorButton_Click(object sender, EventArgs e) {
     142      if (!SuppressEvents && Content != null) {
     143        SuppressEvents = true;
     144        try {
     145          Content.Color = Color.Empty;
     146          colorButton.BackColor = SystemColors.Control;
     147          colorButton.Text = "?";
     148          clearColorButton.Visible = false;
     149        } finally { SuppressEvents = false; }
    130150      }
    131151    }
     
    178198        try {
    179199          Content.ExactBins = binsExactRadioButton.Checked;
     200        } finally { SuppressEvents = false; }
     201      }
     202    }
     203
     204    private void aggregationComboBox_SelectedValueChanged(object sender, EventArgs e) {
     205      if (!SuppressEvents && Content != null) {
     206        SuppressEvents = true;
     207        try {
     208          Content.Aggregation = (DataRowVisualProperties.DataRowHistogramAggregation)aggregationComboBox.SelectedValue;
    180209        } finally { SuppressEvents = false; }
    181210      }
  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataTableControl.Designer.cs

    r14449 r14589  
    7171      legend1.Alignment = System.Drawing.StringAlignment.Center;
    7272      legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
     73      legend1.LegendItemOrder = System.Windows.Forms.DataVisualization.Charting.LegendItemOrder.ReversedSeriesOrder;
    7374      legend1.Name = "Default";
    7475      this.chart.Legends.Add(legend1);
  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataTableControl.cs

    r14542 r14589  
    118118      foreach (var row in rows) {
    119119        RegisterDataRowEvents(row);
    120         var series = new Series(row.Name);
     120        var series = new Series(row.Name) {
     121          Tag = row
     122        };
    121123        if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName;
    122124        else series.LegendText = row.Name;
     
    128130      RecalculateAxesScale(chart.ChartAreas[0]);
    129131      UpdateYCursorInterval();
     132      UpdateHistogramTransparency();
    130133    }
    131134
     
    174177          break;
    175178        case DataRowVisualProperties.DataRowChartType.Histogram:
    176           series.ChartType = SeriesChartType.StackedColumn;
     179          bool stacked = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Stacked;
     180          series.ChartType = stacked ? SeriesChartType.StackedColumn : SeriesChartType.Column;
     181          bool sideBySide = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.SideBySide;
     182          series.SetCustomProperty("DrawSideBySide", sideBySide ? "True" : "False");
    177183          series.SetCustomProperty("PointWidth", "1");
    178184          if (!series.Color.IsEmpty && series.Color.GetBrightness() < 0.25)
     
    275281    }
    276282
     283    protected void UpdateHistogramTransparency() {
     284      if (Content.Rows.Any(r => RequiresTransparency(r) && r.VisualProperties.Color.IsEmpty)) {
     285        foreach (var series in chart.Series) // sync colors before applying palette colors
     286          series.Color = ((DataRow)series.Tag).VisualProperties.Color;
     287        chart.ApplyPaletteColors();
     288      }
     289
     290      var numTransparent = Content.Rows.Count(RequiresTransparency);
     291      if (numTransparent <= 1) return;
     292      foreach (var series in chart.Series) {
     293        var row = (DataRow)series.Tag;
     294        if (!RequiresTransparency(row))
     295          continue;
     296        var baseColor = row.VisualProperties.Color;
     297        if (baseColor.IsEmpty) baseColor = series.Color;
     298        series.Color = Color.FromArgb(180, baseColor);
     299      }
     300    }
     301    private bool RequiresTransparency(DataRow row) {
     302      return row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram
     303             && row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Overlapping;
     304    }
     305
    277306    #region Event Handlers
    278307    #region Content Event Handlers
     
    327356        series.Points.Clear();
    328357        ConfigureSeries(series, row);
    329         FillSeriesWithRowValues(series, row);
    330         RecalculateAxesScale(chart.ChartAreas[0]);
     358        if (!invisibleSeries.Contains(series)) {
     359          FillSeriesWithRowValues(series, row);
     360          RecalculateAxesScale(chart.ChartAreas[0]);
     361          UpdateHistogramTransparency();
     362        }
    331363      }
    332364    }
  • branches/symbreg-factors-2650/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r14185 r14589  
    6969      this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    7070      this.okButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    71       this.okButton.Location = new System.Drawing.Point(325, 425);
     71      this.okButton.Location = new System.Drawing.Point(325, 454);
    7272      this.okButton.Name = "okButton";
    7373      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    8181      this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    8282      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    83       this.cancelButton.Location = new System.Drawing.Point(406, 425);
     83      this.cancelButton.Location = new System.Drawing.Point(406, 454);
    8484      this.cancelButton.Name = "cancelButton";
    8585      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    9999      this.tabControl.Name = "tabControl";
    100100      this.tabControl.SelectedIndex = 0;
    101       this.tabControl.Size = new System.Drawing.Size(469, 407);
     101      this.tabControl.Size = new System.Drawing.Size(469, 436);
    102102      this.tabControl.TabIndex = 2;
    103103      //
     
    108108      this.seriesTabPage.Name = "seriesTabPage";
    109109      this.seriesTabPage.Padding = new System.Windows.Forms.Padding(3);
    110       this.seriesTabPage.Size = new System.Drawing.Size(461, 381);
     110      this.seriesTabPage.Size = new System.Drawing.Size(461, 410);
    111111      this.seriesTabPage.TabIndex = 0;
    112112      this.seriesTabPage.Text = "Series";
     
    133133      this.splitContainer.Panel2.Controls.Add(this.dataRowVisualPropertiesControl);
    134134      this.splitContainer.Panel2MinSize = 50;
    135       this.splitContainer.Size = new System.Drawing.Size(461, 381);
     135      this.splitContainer.Size = new System.Drawing.Size(461, 410);
    136136      this.splitContainer.SplitterDistance = 125;
    137137      this.splitContainer.TabIndex = 0;
     
    169169      this.seriesListView.Name = "seriesListView";
    170170      this.seriesListView.ShowGroups = false;
    171       this.seriesListView.Size = new System.Drawing.Size(119, 346);
     171      this.seriesListView.Size = new System.Drawing.Size(119, 375);
    172172      this.seriesListView.TabIndex = 2;
    173173      this.seriesListView.UseCompatibleStateImageBehavior = false;
     
    183183      this.dataRowVisualPropertiesControl.Location = new System.Drawing.Point(3, 26);
    184184      this.dataRowVisualPropertiesControl.Name = "dataRowVisualPropertiesControl";
    185       this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(326, 352);
     185      this.dataRowVisualPropertiesControl.Size = new System.Drawing.Size(326, 381);
    186186      this.dataRowVisualPropertiesControl.TabIndex = 0;
    187187      //
     
    213213      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    214214      this.CancelButton = this.cancelButton;
    215       this.ClientSize = new System.Drawing.Size(493, 460);
     215      this.ClientSize = new System.Drawing.Size(493, 489);
    216216      this.Controls.Add(this.tabControl);
    217217      this.Controls.Add(this.cancelButton);
  • branches/symbreg-factors-2650/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs

    r14185 r14589  
    5252    }
    5353    #endregion
     54    #region Histogram Aggregation
     55    public enum DataRowHistogramAggregation {
     56      Overlapping,
     57      SideBySide,
     58      Stacked
     59    }
     60    #endregion
    5461
    5562    private DataRowChartType chartType;
     
    140147          exactBins = value;
    141148          OnPropertyChanged("ExactBins");
     149        }
     150      }
     151    }
     152    private DataRowHistogramAggregation aggregation;
     153    public DataRowHistogramAggregation Aggregation {
     154      get { return aggregation; }
     155      set {
     156        if (aggregation != value) {
     157          aggregation = value;
     158          OnPropertyChanged("Aggregation");
    142159        }
    143160      }
     
    224241      get { return exactBins; }
    225242      set { exactBins = value; }
     243    }
     244    [Storable(Name = "Aggregation", DefaultValue = DataRowHistogramAggregation.Overlapping)]
     245    private DataRowHistogramAggregation StorableAggregation {
     246      get { return aggregation; }
     247      set { aggregation = value; }
    226248    }
    227249    [Storable(Name = "ScaleFactor")]
     
    255277      this.bins = original.bins;
    256278      this.exactBins = original.exactBins;
     279      this.aggregation = original.aggregation;
    257280      this.scaleFactor = original.scaleFactor;
    258281      this.displayName = original.displayName;
     
    269292      bins = 10;
    270293      exactBins = false;
     294      aggregation = DataRowHistogramAggregation.Overlapping;
    271295      scaleFactor = 1.0;
    272296      displayName = String.Empty;
  • branches/symbreg-factors-2650/HeuristicLab.Data.Views

  • branches/symbreg-factors-2650/HeuristicLab.Data.Views/3.3

  • branches/symbreg-factors-2650/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r14330 r14589  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.ComponentModel;
    2425using System.Drawing;
     
    200201      }
    201202
     203      var elementNames = Content.ElementNames.ToList();
    202204      for (int i = minRowIndex; i <= maxRowIndex; i++) {
    203205        DataGridViewColumn column = dataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible);
    204206        DataGridViewCell cell = dataGridView[column.Index, i];
    205207        if (cell.Selected) {
    206           s.Append(Content.ElementNames.ElementAt(i));
    207           s.Append("\t");
     208          if (i < elementNames.Count) {
     209            s.Append(elementNames[i]);
     210            s.Append("\t");
     211          } else if (elementNames.Count > 0) {
     212            s.Append("Index " + i);
     213            s.Append("\t");
     214          }
    208215          s.Append(Content.GetValue(i));
    209216          s.Append(Environment.NewLine);
     
    213220    }
    214221    private void PasteValuesToDataGridView() {
    215       string[] values = SplitClipboardString(Clipboard.GetText());
     222      Tuple<string, string>[] values = null;
     223      try {
     224        values = SplitClipboardString(Clipboard.GetText()).ToArray();
     225      } catch (ArgumentException ex) {
     226        MessageBox.Show(this, ex.Message, "Error while parsing clipboard text.", MessageBoxButtons.OK, MessageBoxIcon.Error);
     227        return;
     228      }
    216229      int rowIndex = 0;
    217230      if (dataGridView.CurrentCell != null)
     
    219232
    220233      if (Content.Length < rowIndex + values.Length) Content.Length = rowIndex + values.Length;
    221       for (int row = 0; row < values.Length; row++)
    222         Content.SetValue(values[row], row + rowIndex);
    223     }
    224     private string[] SplitClipboardString(string clipboardText) {
     234      for (int row = 0; row < values.Length; row++) {
     235        Content.SetValue(values[row].Item2, row + rowIndex);
     236      }
     237      if (values.Any(x => !string.IsNullOrEmpty(x.Item1))) {
     238        var elementNames = Content.ElementNames.ToList();
     239        for (int row = 0; row < values.Length; row++) {
     240          if (row + rowIndex < elementNames.Count)
     241            elementNames[row + rowIndex] = values[row].Item1;
     242          else elementNames.Add(values[row].Item1);
     243        }
     244        Content.ElementNames = elementNames;
     245      }
     246    }
     247    private IEnumerable<Tuple<string, string>> SplitClipboardString(string clipboardText) {
    225248      if (clipboardText.EndsWith(Environment.NewLine))
    226249        clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length);  //remove last newline constant
    227       return clipboardText.Split(new string[] { Environment.NewLine, "\t" }, StringSplitOptions.None);
     250
     251      var lines = clipboardText.Split(new [] { Environment.NewLine }, StringSplitOptions.None);
     252      var tabSep = new[] { '\t' };
     253      if (lines.Length > 2) {
     254        // Case 1: Each line contains either "elementName \t value" or just "value" (one or two vertical vectors)
     255        foreach (var l in lines) {
     256          var row = l.Split(tabSep, StringSplitOptions.RemoveEmptyEntries);
     257          if (row.Length > 2) throw new ArgumentException("Clipboard may have either at most two rows or at most two columns.");
     258          if (row.Length == 2) yield return Tuple.Create(row[0], row[1]);
     259          else if (row.Length == 1) yield return Tuple.Create(string.Empty, row[0]);
     260          else yield return Tuple.Create(string.Empty, string.Empty);
     261        }
     262      } else if (lines.Length == 2) {
     263        var firstLine = lines[0].Split(tabSep, StringSplitOptions.None);
     264        var secondLine = lines[1].Split(tabSep, StringSplitOptions.None);
     265        if (firstLine.Length <= 2 && secondLine.Length <= 2) {
     266          // Case 2a: The two lines contain either "elementName \t value" or just "value" (one or two vertical vectors)
     267          yield return firstLine.Length >= 2 ? Tuple.Create(firstLine[0], firstLine[1]) : Tuple.Create(string.Empty, firstLine[0]);
     268          yield return secondLine.Length >= 2 ? Tuple.Create(secondLine[0], secondLine[1]) : Tuple.Create(string.Empty, secondLine[0]);
     269        } else {
     270          // Case 2b: The first line contains the elementNames, the second line contains the values (two horizontal vectors)
     271          var max = Math.Max(firstLine.Length, secondLine.Length);
     272          for (var i = 0; i < max; i++) {
     273            var elemName = i < firstLine.Length ? firstLine[i] : string.Empty;
     274            var value = i < secondLine.Length ? secondLine[i] : string.Empty;
     275            yield return Tuple.Create(elemName, value);
     276          }
     277        }
     278      } else if (lines.Length == 1) {
     279        // Case 3: The line contains the values (one horizontal vector)
     280        var entries = lines[0].Split(tabSep, StringSplitOptions.None);
     281        foreach (var e in entries) {
     282          yield return Tuple.Create(string.Empty, e);
     283        }
     284      }
    228285    }
    229286    #endregion
  • branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views

  • branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r14449 r14589  
    554554      if (e.KeyCode == Keys.Delete) {
    555555        //Delete column
    556         if (dataGridView.SelectedColumns.Count == 1) {
    557           Content.DeleteColumn(dataGridView.SelectedColumns[0].Index);
     556        if (dataGridView.SelectedColumns.Count > 0) {
     557          var columnsToDelete = dataGridView.SelectedColumns.Cast<DataGridViewColumn>().OrderByDescending(col => col.Index).ToList();
     558          foreach (var col in columnsToDelete)
     559            Content.DeleteColumn(col.Index);
    558560        }
    559561        //Delete row
  • branches/symbreg-factors-2650/HeuristicLab.MainForm.WindowsForms/3.3/Views/View.cs

    r14542 r14589  
    3434      this.closeReason = CloseReason.None;
    3535      this.readOnly = false;
    36 
    3736      if (ViewAttribute.HasViewAttribute(this.GetType()))
    3837        this.Caption = ViewAttribute.GetViewName(this.GetType());
     
    4645      set {
    4746        if (InvokeRequired) {
    48           Action<string> action = delegate (string s) { this.Caption = s; };
     47          Action<string> action = delegate(string s) { this.Caption = s; };
    4948          Invoke(action, value);
    5049        } else {
     
    6261      set {
    6362        if (InvokeRequired) {
    64           Action<bool> action = delegate (bool b) { this.ReadOnly = b; };
     63          Action<bool> action = delegate(bool b) { this.ReadOnly = b; };
    6564          Invoke(action, value);
    6665        } else {
     
    9594
    9695    protected override void OnEnabledChanged(EventArgs e) {
    97       SuspendRepaint();
    9896      base.OnEnabledChanged(e);
    9997      if (Enabled) SetEnabledStateOfControls();
    100       ResumeRepaint(true);
    10198    }
    10299
Note: See TracChangeset for help on using the changeset viewer.