Changeset 15068


Ignore:
Timestamp:
06/27/17 10:06:34 (7 weeks ago)
Author:
pfleck
Message:

#2715 Moved the histogram properties (nr of bins, exact/approximate bins, aggregation) from DataRowVisualProperties to DataTableVisualProperties

  • Adapted DataRow/TableVisualPropertiesControl
  • Backwards compatability is handled in the DataTable (DataTableVisualProperties has no access to the DataRowVisualProperties)
Location:
trunk/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.Designer.cs

    r14582 r15068  
    4949      this.colorButton = new System.Windows.Forms.Button();
    5050      this.startIndexZeroCheckBox = new System.Windows.Forms.CheckBox();
    51       this.binsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    5251      this.label1 = new System.Windows.Forms.Label();
    5352      this.label2 = new System.Windows.Forms.Label();
    54       this.label3 = new System.Windows.Forms.Label();
    5553      this.commonGroupBox = new System.Windows.Forms.GroupBox();
    5654      this.clearColorButton = new System.Windows.Forms.Button();
     
    6866      this.label6 = new System.Windows.Forms.Label();
    6967      this.label9 = new System.Windows.Forms.Label();
    70       this.histoGramGroupBox = new System.Windows.Forms.GroupBox();
    71       this.binsExactRadioButton = new System.Windows.Forms.RadioButton();
    72       this.binsApproximatelyRadioButton = new System.Windows.Forms.RadioButton();
    73       this.label11 = new System.Windows.Forms.Label();
    74       this.aggregationComboBox = new System.Windows.Forms.ComboBox();
    7568      this.lineChartGroupBox = new System.Windows.Forms.GroupBox();
    7669      this.lineWidthNumericUpDown = new System.Windows.Forms.NumericUpDown();
     
    7972      this.lineStyleComboBox = new System.Windows.Forms.ComboBox();
    8073      this.label8 = new System.Windows.Forms.Label();
    81       ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).BeginInit();
    8274      this.commonGroupBox.SuspendLayout();
    8375      this.axisGroupBox.SuspendLayout();
    8476      this.panel2.SuspendLayout();
    8577      this.panel1.SuspendLayout();
    86       this.histoGramGroupBox.SuspendLayout();
    8778      this.lineChartGroupBox.SuspendLayout();
    8879      ((System.ComponentModel.ISupportInitialize)(this.lineWidthNumericUpDown)).BeginInit();
     
    9182      // chartTypeComboBox
    9283      //
    93       this.chartTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     84      this.chartTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    9485            | System.Windows.Forms.AnchorStyles.Right)));
    9586      this.chartTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    126117      this.startIndexZeroCheckBox.CheckedChanged += new System.EventHandler(this.startIndexZeroCheckBox_CheckedChanged);
    127118      //
    128       // binsNumericUpDown
    129       //
    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);
    133       this.binsNumericUpDown.Minimum = new decimal(new int[] {
    134             1,
    135             0,
    136             0,
    137             0});
    138       this.binsNumericUpDown.Name = "binsNumericUpDown";
    139       this.binsNumericUpDown.Size = new System.Drawing.Size(72, 20);
    140       this.binsNumericUpDown.TabIndex = 1;
    141       this.binsNumericUpDown.Value = new decimal(new int[] {
    142             1,
    143             0,
    144             0,
    145             0});
    146       this.binsNumericUpDown.ValueChanged += new System.EventHandler(this.binsNumericUpDown_ValueChanged);
    147       //
    148119      // label1
    149120      //
     
    164135      this.label2.Text = "&Color:";
    165136      //
    166       // label3
    167       //
    168       this.label3.AutoSize = true;
    169       this.label3.Location = new System.Drawing.Point(6, 21);
    170       this.label3.Name = "label3";
    171       this.label3.Size = new System.Drawing.Size(30, 13);
    172       this.label3.TabIndex = 0;
    173       this.label3.Text = "&Bins:";
    174       //
    175137      // commonGroupBox
    176138      //
    177       this.commonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     139      this.commonGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    178140            | System.Windows.Forms.AnchorStyles.Right)));
    179141      this.commonGroupBox.Controls.Add(this.clearColorButton);
     
    232194      // displayNameTextBox
    233195      //
    234       this.displayNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     196      this.displayNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    235197            | System.Windows.Forms.AnchorStyles.Right)));
    236198      this.displayNameTextBox.Location = new System.Drawing.Point(102, 19);
     
    242204      // axisGroupBox
    243205      //
    244       this.axisGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    245             | System.Windows.Forms.AnchorStyles.Left)
     206      this.axisGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     207            | System.Windows.Forms.AnchorStyles.Left) 
    246208            | System.Windows.Forms.AnchorStyles.Right)));
    247209      this.axisGroupBox.Controls.Add(this.panel2);
     
    258220      // panel2
    259221      //
    260       this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     222      this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    261223            | System.Windows.Forms.AnchorStyles.Right)));
    262224      this.panel2.Controls.Add(this.yAxisSecondaryRadioButton);
     
    293255      // panel1
    294256      //
    295       this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     257      this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    296258            | System.Windows.Forms.AnchorStyles.Right)));
    297259      this.panel1.Controls.Add(this.xAxisPrimaryRadioButton);
     
    353315      this.label9.Text = "&Name:";
    354316      //
    355       // histoGramGroupBox
    356       //
    357       this.histoGramGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    358             | System.Windows.Forms.AnchorStyles.Right)));
    359       this.histoGramGroupBox.Controls.Add(this.binsExactRadioButton);
    360       this.histoGramGroupBox.Controls.Add(this.binsApproximatelyRadioButton);
    361       this.histoGramGroupBox.Controls.Add(this.binsNumericUpDown);
    362       this.histoGramGroupBox.Controls.Add(this.label11);
    363       this.histoGramGroupBox.Controls.Add(this.label3);
    364       this.histoGramGroupBox.Controls.Add(this.aggregationComboBox);
    365       this.histoGramGroupBox.Location = new System.Drawing.Point(0, 305);
    366       this.histoGramGroupBox.Name = "histoGramGroupBox";
    367       this.histoGramGroupBox.Size = new System.Drawing.Size(327, 75);
    368       this.histoGramGroupBox.TabIndex = 2;
    369       this.histoGramGroupBox.TabStop = false;
    370       this.histoGramGroupBox.Text = "Histogram Properties";
    371       //
    372       // binsExactRadioButton
    373       //
    374       this.binsExactRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    375       this.binsExactRadioButton.AutoSize = true;
    376       this.binsExactRadioButton.Location = new System.Drawing.Point(269, 19);
    377       this.binsExactRadioButton.Name = "binsExactRadioButton";
    378       this.binsExactRadioButton.Size = new System.Drawing.Size(52, 17);
    379       this.binsExactRadioButton.TabIndex = 3;
    380       this.binsExactRadioButton.TabStop = true;
    381       this.binsExactRadioButton.Text = "&Exact";
    382       this.binsExactRadioButton.UseVisualStyleBackColor = true;
    383       this.binsExactRadioButton.CheckedChanged += new System.EventHandler(this.binNumberRadioButton_CheckedChanged);
    384       //
    385       // binsApproximatelyRadioButton
    386       //
    387       this.binsApproximatelyRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    388       this.binsApproximatelyRadioButton.AutoSize = true;
    389       this.binsApproximatelyRadioButton.Location = new System.Drawing.Point(173, 19);
    390       this.binsApproximatelyRadioButton.Name = "binsApproximatelyRadioButton";
    391       this.binsApproximatelyRadioButton.Size = new System.Drawing.Size(90, 17);
    392       this.binsApproximatelyRadioButton.TabIndex = 2;
    393       this.binsApproximatelyRadioButton.TabStop = true;
    394       this.binsApproximatelyRadioButton.Text = "&Approximately";
    395       this.binsApproximatelyRadioButton.UseVisualStyleBackColor = true;
    396       this.binsApproximatelyRadioButton.CheckedChanged += new System.EventHandler(this.binNumberRadioButton_CheckedChanged);
    397       //
    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       //
    419317      // lineChartGroupBox
    420318      //
    421       this.lineChartGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     319      this.lineChartGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    422320            | System.Windows.Forms.AnchorStyles.Right)));
    423321      this.lineChartGroupBox.Controls.Add(this.lineWidthNumericUpDown);
     
    436334      // lineWidthNumericUpDown
    437335      //
    438       this.lineWidthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     336      this.lineWidthNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    439337            | System.Windows.Forms.AnchorStyles.Right)));
    440338      this.lineWidthNumericUpDown.Location = new System.Drawing.Point(82, 66);
     
    474372      // lineStyleComboBox
    475373      //
    476       this.lineStyleComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     374      this.lineStyleComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    477375            | System.Windows.Forms.AnchorStyles.Right)));
    478376      this.lineStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     
    497395      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    498396      this.Controls.Add(this.lineChartGroupBox);
    499       this.Controls.Add(this.histoGramGroupBox);
    500397      this.Controls.Add(this.commonGroupBox);
    501398      this.Name = "DataRowVisualPropertiesControl";
    502       this.Size = new System.Drawing.Size(327, 382);
    503       ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).EndInit();
     399      this.Size = new System.Drawing.Size(327, 300);
    504400      this.commonGroupBox.ResumeLayout(false);
    505401      this.commonGroupBox.PerformLayout();
     
    510406      this.panel1.ResumeLayout(false);
    511407      this.panel1.PerformLayout();
    512       this.histoGramGroupBox.ResumeLayout(false);
    513       this.histoGramGroupBox.PerformLayout();
    514408      this.lineChartGroupBox.ResumeLayout(false);
    515409      this.lineChartGroupBox.PerformLayout();
     
    525419    private System.Windows.Forms.Button colorButton;
    526420    private System.Windows.Forms.CheckBox startIndexZeroCheckBox;
    527     private System.Windows.Forms.NumericUpDown binsNumericUpDown;
    528421    private System.Windows.Forms.Label label1;
    529422    private System.Windows.Forms.Label label2;
    530     private System.Windows.Forms.Label label3;
    531423    private System.Windows.Forms.GroupBox commonGroupBox;
    532     private System.Windows.Forms.GroupBox histoGramGroupBox;
    533424    private System.Windows.Forms.RadioButton xAxisSecondaryRadioButton;
    534425    private System.Windows.Forms.RadioButton yAxisSecondaryRadioButton;
     
    540431    private System.Windows.Forms.Label label4;
    541432    private System.Windows.Forms.Label label7;
    542     private System.Windows.Forms.RadioButton binsExactRadioButton;
    543     private System.Windows.Forms.RadioButton binsApproximatelyRadioButton;
    544433    private System.Windows.Forms.ComboBox lineStyleComboBox;
    545434    private System.Windows.Forms.Label label8;
     
    552441    private System.Windows.Forms.Label label10;
    553442    private System.Windows.Forms.CheckBox isVisibleInLegendCheckBox;
    554     private System.Windows.Forms.Label label11;
    555     private System.Windows.Forms.ComboBox aggregationComboBox;
    556443    private System.Windows.Forms.Button clearColorButton;
    557444  }
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.cs

    r14582 r15068  
    4646      chartTypeComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowChartType));
    4747      lineStyleComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowLineStyle));
    48       aggregationComboBox.DataSource = Enum.GetValues(typeof(DataRowVisualProperties.DataRowHistogramAggregation));
    4948      clearColorButton.BackColor = Color.Transparent;
    5049      clearColorButton.BackgroundImage = VSImageLibrary.Delete;
     
    6665          startIndexZeroCheckBox.Checked = false;
    6766          lineWidthNumericUpDown.Value = 1;
    68           binsNumericUpDown.Value = 1;
    69           binsApproximatelyRadioButton.Checked = false;
    70           binsExactRadioButton.Checked = false;
    71           aggregationComboBox.SelectedIndex = -1;
    7267          displayNameTextBox.Text = String.Empty;
    7368        } else {
     
    9186            lineWidthNumericUpDown.Value = lineWidthNumericUpDown.Maximum;
    9287          else lineWidthNumericUpDown.Value = Content.LineWidth;
    93           if (Content.Bins < binsNumericUpDown.Minimum)
    94             binsNumericUpDown.Value = binsNumericUpDown.Minimum;
    95           else if (Content.Bins > binsNumericUpDown.Maximum)
    96             binsNumericUpDown.Value = binsNumericUpDown.Maximum;
    97           else binsNumericUpDown.Value = Content.Bins;
    98           binsApproximatelyRadioButton.Checked = !Content.ExactBins;
    99           binsExactRadioButton.Checked = Content.ExactBins;
    100           aggregationComboBox.SelectedItem = Content.Aggregation;
    10188          displayNameTextBox.Text = Content.DisplayName;
    10289          isVisibleInLegendCheckBox.Checked = Content.IsVisibleInLegend;
     
    11097      clearColorButton.Visible = Content != null && !Content.Color.IsEmpty;
    11198      lineChartGroupBox.Enabled = Content != null && Content.ChartType == DataRowVisualProperties.DataRowChartType.Line;
    112       histoGramGroupBox.Enabled = Content != null && Content.ChartType == DataRowVisualProperties.DataRowChartType.Histogram;
    11399      isVisibleInLegendCheckBox.Enabled = Content != null;
    114100    }
     
    187173    }
    188174
    189     private void binsNumericUpDown_ValueChanged(object sender, EventArgs e) {
    190       if (!SuppressEvents && Content != null) {
    191         Content.Bins = (int)binsNumericUpDown.Value;
    192       }
    193     }
    194 
    195     private void binNumberRadioButton_CheckedChanged(object sender, EventArgs e) {
    196       if (!SuppressEvents && Content != null) {
    197         SuppressEvents = true;
    198         try {
    199           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;
    209         } finally { SuppressEvents = false; }
    210       }
    211     }
    212 
    213175    private void displayNameTextBox_Validated(object sender, EventArgs e) {
    214176      if (!SuppressEvents && Content != null) {
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r15042 r15068  
    206206          break;
    207207        case DataRowVisualProperties.DataRowChartType.Histogram:
    208           bool stacked = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Stacked;
     208          bool stacked = Content.VisualProperties.HistogramAggregation == DataTableVisualProperties.DataTableHistogramAggregation.Stacked;
    209209          series.ChartType = stacked ? SeriesChartType.StackedColumn : SeriesChartType.Column;
    210           bool sideBySide = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.SideBySide;
     210          bool sideBySide = Content.VisualProperties.HistogramAggregation == DataTableVisualProperties.DataTableHistogramAggregation.SideBySide;
    211211          series.SetCustomProperty("DrawSideBySide", sideBySide ? "True" : "False");
    212212          series.SetCustomProperty("PointWidth", "1");
     
    330330    private bool RequiresTransparency(DataRow row) {
    331331      return row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram
    332              && row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Overlapping;
     332             && Content.VisualProperties.HistogramAggregation == DataTableVisualProperties.DataTableHistogramAggregation.Overlapping;
    333333    }
    334334
     
    349349        ConfigureChartArea(chart.ChartAreas[0]);
    350350        RecalculateAxesScale(chart.ChartAreas[0]); // axes min/max could have changed
     351        foreach (var row in Content.Rows.Where(r => r.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram))
     352          Row_VisualPropertiesChanged(row, EventArgs.Empty); // Histogram properties could have changed
     353        chart.Update(); // side-by-side series are not always correctly displayed without an update
    351354      }
    352355    }
     
    562565      switch (row.VisualProperties.ChartType) {
    563566        case DataRowVisualProperties.DataRowChartType.Histogram:
    564           // when a single histogram is updated, all histograms must be updated. otherwise the value ranges and bin sizes may not be equal.
     567          // when a single histogram is updated, all histograms must be updated. otherwise the value ranges may not be equal.
    565568          var histograms = Content.Rows
    566569            .Where(r => r.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram)
     
    606609      if (!validValues.Any()) return;
    607610
    608       int bins = histogramRows.Max(r => r.VisualProperties.Bins);
     611      int bins = Content.VisualProperties.HistogramBins;
    609612      decimal minValue = (decimal)validValues.Min();
    610613      decimal maxValue = (decimal)validValues.Max();
     
    616619      }
    617620
    618       if (!histogramRows.Any(r => r.VisualProperties.ExactBins)) {
     621      if (!Content.VisualProperties.HistogramExactBins) {
    619622        intervalWidth = (decimal)HumanRoundRange((double)intervalWidth);
    620623        minValue = Math.Floor(minValue / intervalWidth) * intervalWidth;
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.Designer.cs

    r14185 r15068  
    105105      this.label7 = new System.Windows.Forms.Label();
    106106      this.label8 = new System.Windows.Forms.Label();
     107      this.histogramTabPage = new System.Windows.Forms.TabPage();
     108      this.histogramGroupBox = new System.Windows.Forms.GroupBox();
     109      this.histogramBinsExactRadioButton = new System.Windows.Forms.RadioButton();
     110      this.histogramBinsApproximatelyRadioButton = new System.Windows.Forms.RadioButton();
     111      this.histogramBinsNumericUpDown = new System.Windows.Forms.NumericUpDown();
     112      this.label16 = new System.Windows.Forms.Label();
     113      this.label17 = new System.Windows.Forms.Label();
     114      this.histogramAggregationComboBox = new System.Windows.Forms.ComboBox();
    107115      this.titleTextBox = new System.Windows.Forms.TextBox();
    108116      this.label15 = new System.Windows.Forms.Label();
     
    131139      this.panel6.SuspendLayout();
    132140      this.panel5.SuspendLayout();
     141      this.histogramTabPage.SuspendLayout();
     142      this.histogramGroupBox.SuspendLayout();
     143      ((System.ComponentModel.ISupportInitialize)(this.histogramBinsNumericUpDown)).BeginInit();
    133144      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    134145      this.SuspendLayout();
     
    489500      this.axisTabControl.Controls.Add(this.xAxisTabPage);
    490501      this.axisTabControl.Controls.Add(this.yAxisTabPage);
     502      this.axisTabControl.Controls.Add(this.histogramTabPage);
    491503      this.axisTabControl.Location = new System.Drawing.Point(0, 84);
    492504      this.axisTabControl.Name = "axisTabControl";
     
    791803      this.label8.TabIndex = 2;
    792804      this.label8.Text = "&Minimum:";
     805      //
     806      // histogramTabPage
     807      //
     808      this.histogramTabPage.Controls.Add(this.histogramGroupBox);
     809      this.histogramTabPage.Location = new System.Drawing.Point(4, 22);
     810      this.histogramTabPage.Name = "histogramTabPage";
     811      this.histogramTabPage.Padding = new System.Windows.Forms.Padding(3);
     812      this.histogramTabPage.Size = new System.Drawing.Size(447, 263);
     813      this.histogramTabPage.TabIndex = 2;
     814      this.histogramTabPage.Text = "Histogram";
     815      this.histogramTabPage.UseVisualStyleBackColor = true;
     816      //
     817      // histogramGroupBox
     818      //
     819      this.histogramGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     820            | System.Windows.Forms.AnchorStyles.Right)));
     821      this.histogramGroupBox.Controls.Add(this.histogramBinsExactRadioButton);
     822      this.histogramGroupBox.Controls.Add(this.histogramBinsApproximatelyRadioButton);
     823      this.histogramGroupBox.Controls.Add(this.histogramBinsNumericUpDown);
     824      this.histogramGroupBox.Controls.Add(this.label16);
     825      this.histogramGroupBox.Controls.Add(this.label17);
     826      this.histogramGroupBox.Controls.Add(this.histogramAggregationComboBox);
     827      this.histogramGroupBox.Location = new System.Drawing.Point(3, 3);
     828      this.histogramGroupBox.Name = "histogramGroupBox";
     829      this.histogramGroupBox.Size = new System.Drawing.Size(441, 75);
     830      this.histogramGroupBox.TabIndex = 2;
     831      this.histogramGroupBox.TabStop = false;
     832      this.histogramGroupBox.Text = "Histogram Properties";
     833      //
     834      // histogramBinsExactRadioButton
     835      //
     836      this.histogramBinsExactRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     837      this.histogramBinsExactRadioButton.AutoSize = true;
     838      this.histogramBinsExactRadioButton.Location = new System.Drawing.Point(383, 19);
     839      this.histogramBinsExactRadioButton.Name = "histogramBinsExactRadioButton";
     840      this.histogramBinsExactRadioButton.Size = new System.Drawing.Size(52, 17);
     841      this.histogramBinsExactRadioButton.TabIndex = 3;
     842      this.histogramBinsExactRadioButton.TabStop = true;
     843      this.histogramBinsExactRadioButton.Text = "&Exact";
     844      this.histogramBinsExactRadioButton.UseVisualStyleBackColor = true;
     845      this.histogramBinsExactRadioButton.CheckedChanged += new System.EventHandler(this.histogramBinsExactRadioButton_CheckedChanged);
     846      //
     847      // histogramBinsApproximatelyRadioButton
     848      //
     849      this.histogramBinsApproximatelyRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     850      this.histogramBinsApproximatelyRadioButton.AutoSize = true;
     851      this.histogramBinsApproximatelyRadioButton.Location = new System.Drawing.Point(287, 19);
     852      this.histogramBinsApproximatelyRadioButton.Name = "histogramBinsApproximatelyRadioButton";
     853      this.histogramBinsApproximatelyRadioButton.Size = new System.Drawing.Size(90, 17);
     854      this.histogramBinsApproximatelyRadioButton.TabIndex = 2;
     855      this.histogramBinsApproximatelyRadioButton.TabStop = true;
     856      this.histogramBinsApproximatelyRadioButton.Text = "&Approximately";
     857      this.histogramBinsApproximatelyRadioButton.UseVisualStyleBackColor = true;
     858      //
     859      // histogramBinsNumericUpDown
     860      //
     861      this.histogramBinsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     862            | System.Windows.Forms.AnchorStyles.Right)));
     863      this.histogramBinsNumericUpDown.Location = new System.Drawing.Point(82, 19);
     864      this.histogramBinsNumericUpDown.Minimum = new decimal(new int[] {
     865            1,
     866            0,
     867            0,
     868            0});
     869      this.histogramBinsNumericUpDown.Name = "histogramBinsNumericUpDown";
     870      this.histogramBinsNumericUpDown.Size = new System.Drawing.Size(186, 20);
     871      this.histogramBinsNumericUpDown.TabIndex = 1;
     872      this.histogramBinsNumericUpDown.Value = new decimal(new int[] {
     873            1,
     874            0,
     875            0,
     876            0});
     877      this.histogramBinsNumericUpDown.ValueChanged += new System.EventHandler(this.histogramBinsNumericUpDown_ValueChanged);
     878      //
     879      // label16
     880      //
     881      this.label16.AutoSize = true;
     882      this.label16.Location = new System.Drawing.Point(6, 49);
     883      this.label16.Name = "label16";
     884      this.label16.Size = new System.Drawing.Size(67, 13);
     885      this.label16.TabIndex = 0;
     886      this.label16.Text = "Aggregation:";
     887      //
     888      // label17
     889      //
     890      this.label17.AutoSize = true;
     891      this.label17.Location = new System.Drawing.Point(6, 21);
     892      this.label17.Name = "label17";
     893      this.label17.Size = new System.Drawing.Size(30, 13);
     894      this.label17.TabIndex = 0;
     895      this.label17.Text = "&Bins:";
     896      //
     897      // histogramAggregationComboBox
     898      //
     899      this.histogramAggregationComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     900            | System.Windows.Forms.AnchorStyles.Right)));
     901      this.histogramAggregationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     902      this.histogramAggregationComboBox.FormattingEnabled = true;
     903      this.histogramAggregationComboBox.Location = new System.Drawing.Point(82, 45);
     904      this.histogramAggregationComboBox.Name = "histogramAggregationComboBox";
     905      this.histogramAggregationComboBox.Size = new System.Drawing.Size(353, 21);
     906      this.histogramAggregationComboBox.TabIndex = 3;
     907      this.histogramAggregationComboBox.SelectedValueChanged += new System.EventHandler(this.histogramAggregationComboBox_SelectedValueChanged);
    793908      //
    794909      // titleTextBox
     
    9271042      this.panel5.ResumeLayout(false);
    9281043      this.panel5.PerformLayout();
     1044      this.histogramTabPage.ResumeLayout(false);
     1045      this.histogramGroupBox.ResumeLayout(false);
     1046      this.histogramGroupBox.PerformLayout();
     1047      ((System.ComponentModel.ISupportInitialize)(this.histogramBinsNumericUpDown)).EndInit();
    9291048      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    9301049      this.ResumeLayout(false);
     
    10051124    private System.Windows.Forms.CheckBox yAxisSecondaryLogScaleCheckBox;
    10061125    private System.Windows.Forms.CheckBox yAxisPrimaryLogScaleCheckBox;
     1126    private System.Windows.Forms.TabPage histogramTabPage;
     1127    private System.Windows.Forms.GroupBox histogramGroupBox;
     1128    private System.Windows.Forms.RadioButton histogramBinsExactRadioButton;
     1129    private System.Windows.Forms.RadioButton histogramBinsApproximatelyRadioButton;
     1130    private System.Windows.Forms.NumericUpDown histogramBinsNumericUpDown;
     1131    private System.Windows.Forms.Label label16;
     1132    private System.Windows.Forms.Label label17;
     1133    private System.Windows.Forms.ComboBox histogramAggregationComboBox;
    10071134  }
    10081135}
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.cs

    r14185 r15068  
    2020#endregion
    2121
     22using System;
     23using System.Drawing;
     24using System.Windows.Forms;
    2225using HeuristicLab.MainForm;
    2326using HeuristicLab.MainForm.WindowsForms;
    24 using System.Drawing;
    25 using System.Windows.Forms;
    2627
    2728namespace HeuristicLab.Analysis.Views {
     
    5859      errorProvider.SetIconPadding(yAxisSecondaryMinimumFixedTextBox, 2);
    5960      errorProvider.SetIconPadding(yAxisSecondaryMaximumFixedTextBox, 2);
     61      histogramAggregationComboBox.DataSource = Enum.GetValues(typeof(DataTableVisualProperties.DataTableHistogramAggregation));
    6062    }
    6163
     
    101103          yAxisSecondaryMaximumFixedTextBox.Text = string.Empty;
    102104          yAxisSecondaryLogScaleCheckBox.Checked = false;
     105
     106          histogramBinsNumericUpDown.Value = 1;
     107          histogramBinsApproximatelyRadioButton.Checked = false;
     108          histogramBinsExactRadioButton.Checked = false;
     109          histogramAggregationComboBox.SelectedIndex = -1;
    103110        } else {
    104111          titleFontLabel.Text = "( " + FormatFont(Content.TitleFont) + " )";
     
    139146          yAxisSecondaryMaximumFixedTextBox.Text = Content.SecondYAxisMaximumFixedValue.ToString();
    140147          yAxisSecondaryLogScaleCheckBox.Checked = Content.SecondYAxisLogScale;
     148
     149          if (Content.HistogramBins < histogramBinsNumericUpDown.Minimum)
     150            histogramBinsNumericUpDown.Value = histogramBinsNumericUpDown.Minimum;
     151          else if (Content.HistogramBins > histogramBinsNumericUpDown.Maximum)
     152            histogramBinsNumericUpDown.Value = histogramBinsNumericUpDown.Maximum;
     153          else histogramBinsNumericUpDown.Value = Content.HistogramBins;
     154          histogramBinsApproximatelyRadioButton.Checked = !Content.HistogramExactBins;
     155          histogramBinsExactRadioButton.Checked = Content.HistogramExactBins;
     156          histogramAggregationComboBox.SelectedItem = Content.HistogramAggregation;
    141157        }
    142158      } finally { SuppressEvents = false; }
     
    483499      }
    484500    }
     501
     502    private void histogramBinsNumericUpDown_ValueChanged(object sender, System.EventArgs e) {
     503      if (!SuppressEvents && Content != null) {
     504        Content.HistogramBins = (int)histogramBinsNumericUpDown.Value;
     505      }
     506    }
     507
     508    private void histogramBinsExactRadioButton_CheckedChanged(object sender, System.EventArgs e) {
     509      if (!SuppressEvents && Content != null) {
     510        SuppressEvents = true;
     511        try {
     512          Content.HistogramExactBins = histogramBinsExactRadioButton.Checked;
     513        } finally { SuppressEvents = false; }
     514      }
     515    }
     516
     517    private void histogramAggregationComboBox_SelectedValueChanged(object sender, System.EventArgs e) {
     518      if (!SuppressEvents && Content != null) {
     519        SuppressEvents = true;
     520        try {
     521          Content.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)histogramAggregationComboBox.SelectedValue;
     522        } finally { SuppressEvents = false; }
     523      }
     524    }
    485525    #endregion
    486526
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs

    r14582 r15068  
    5252    }
    5353    #endregion
    54     #region Histogram Aggregation
    55     public enum DataRowHistogramAggregation {
    56       Overlapping,
    57       SideBySide,
    58       Stacked
    59     }
    60     #endregion
    6154
    6255    private DataRowChartType chartType;
     
    130123      }
    131124    }
    132     private int bins;
    133     public int Bins {
    134       get { return bins; }
    135       set {
    136         if (bins != value) {
    137           bins = value;
    138           OnPropertyChanged("Bins");
    139         }
    140       }
    141     }
    142     private bool exactBins;
    143     public bool ExactBins {
    144       get { return exactBins; }
    145       set {
    146         if (exactBins != value) {
    147           exactBins = value;
    148           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");
    159         }
    160       }
    161     }
     125
    162126    private double scaleFactor;
    163127    public double ScaleFactor {
     
    232196      set { lineWidth = value; }
    233197    }
    234     [Storable(Name = "Bins")]
    235     private int StorableBins {
    236       get { return bins; }
    237       set { bins = value; }
    238     }
    239     [Storable(Name = "ExactBins")]
    240     private bool StorableExactBins {
    241       get { return exactBins; }
    242       set { exactBins = value; }
    243     }
    244     [Storable(Name = "Aggregation", DefaultValue = DataRowHistogramAggregation.Overlapping)]
    245     private DataRowHistogramAggregation StorableAggregation {
    246       get { return aggregation; }
    247       set { aggregation = value; }
    248     }
    249198    [Storable(Name = "ScaleFactor")]
    250199    private double StorableScaleFactor {
     
    262211      set { displayName = value; }
    263212    }
     213    #endregion
     214
     215    #region Histogram Properties - Backwards Compatability
     216    internal enum DataRowHistogramAggregation {
     217      Overlapping,
     218      SideBySide,
     219      Stacked
     220    }
     221
     222    internal int? Bins { get; private set; }
     223    internal bool? ExactBins { get; private set; }
     224    internal DataRowHistogramAggregation? Aggregation { get; private set; }
     225
     226    [Storable(Name = "Bins", AllowOneWay = true)]
     227    private int StorableBins { set { Bins = value; } }
     228    [Storable(Name = "ExactBins", AllowOneWay = true)]
     229    private bool StorableExactBins { set { ExactBins = value; } }
     230    [Storable(Name = "Aggregation", AllowOneWay = true)]
     231    private DataRowHistogramAggregation StorableAggregation { set { Aggregation = value; } }
    264232    #endregion
    265233
     
    275243      this.startIndexZero = original.startIndexZero;
    276244      this.lineWidth = original.lineWidth;
    277       this.bins = original.bins;
    278       this.exactBins = original.exactBins;
    279       this.aggregation = original.aggregation;
    280245      this.scaleFactor = original.scaleFactor;
    281246      this.displayName = original.displayName;
     
    290255      startIndexZero = false;
    291256      lineWidth = 1;
    292       bins = 10;
    293       exactBins = false;
    294       aggregation = DataRowHistogramAggregation.Overlapping;
    295257      scaleFactor = 1.0;
    296258      displayName = String.Empty;
     
    318280      if (secondXAxis == default(bool)
    319281        && lineStyle == default(DataRowLineStyle)
    320         && lineWidth == default(int) && bins == default(int) && exactBins == default(bool)
    321282        && displayName == default(string)) {
    322283        secondXAxis = false;
    323284        lineStyle = DataRowLineStyle.Solid;
    324285        lineWidth = 1;
    325         bins = 10;
    326         exactBins = false;
    327286        displayName = String.Empty;
    328287      }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataTable.cs

    r14185 r15068  
    112112      if (VisualProperties == null) VisualProperties = new DataTableVisualProperties(name);
    113113      if (VisualProperties.Title == null) VisualProperties.Title = name;
     114
     115      #region Backwards Compatability Histogram Visual Properties
     116      var rowProperties = Rows.Select(r => r.VisualProperties).ToList();
     117      if (rowProperties.Any(r => r.Bins.HasValue))
     118        VisualProperties.HistogramBins = rowProperties.Where(r => r.Bins.HasValue).Max(r => r.Bins.Value);
     119      if (rowProperties.Any(r => r.ExactBins.HasValue))
     120        VisualProperties.HistogramExactBins = rowProperties.Where(r => r.ExactBins.HasValue).Any(r => r.ExactBins.Value);
     121      if (rowProperties.Any(r => r.Aggregation.HasValue)) {
     122        var maxOccurrence = rowProperties
     123          .Where(r => r.Aggregation.HasValue).Select(r => r.Aggregation.Value)
     124          .GroupBy(x => x).OrderByDescending(x => x.Count())
     125          .First().Key;
     126        VisualProperties.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)maxOccurrence;
     127      }
     128      #endregion
    114129    }
    115130    #endregion
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataTableVisualProperties.cs

    r14185 r15068  
    2020#endregion
    2121
     22using System;
     23using System.ComponentModel;
     24using System.Drawing;
    2225using HeuristicLab.Common;
    2326using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    24 using System.ComponentModel;
    25 using System.Drawing;
    2627
    2728namespace HeuristicLab.Analysis {
     
    3132  [StorableClass]
    3233  public class DataTableVisualProperties : DeepCloneable, INotifyPropertyChanged {
     34
     35    #region Histogram Aggregation
     36    public enum DataTableHistogramAggregation {
     37      Overlapping,
     38      SideBySide,
     39      Stacked
     40    }
     41    #endregion
     42
    3343    private Font titleFont;
    3444    public Font TitleFont {
     
    352362        secondYAxisLogScale = value;
    353363        OnPropertyChanged("SecondYAxisLogScale");
     364      }
     365    }
     366
     367    private int histogramBins;
     368    public int HistogramBins {
     369      get { return histogramBins; }
     370      set {
     371        if (histogramBins != value) {
     372          histogramBins = value;
     373          OnPropertyChanged("HistogramBins");
     374        }
     375      }
     376    }
     377
     378    private bool histogramExactBins;
     379    public bool HistogramExactBins {
     380      get { return histogramExactBins; }
     381      set {
     382        if (histogramExactBins != value) {
     383          histogramExactBins = value;
     384          OnPropertyChanged("HistogramExactBins");
     385        }
     386      }
     387    }
     388
     389    private DataTableHistogramAggregation histogramAggregation;
     390    public DataTableHistogramAggregation HistogramAggregation {
     391      get { return histogramAggregation; }
     392      set {
     393        if (histogramAggregation != value) {
     394          histogramAggregation = value;
     395          OnPropertyChanged("HistogramAggregation");
     396        }
    354397      }
    355398    }
     
    500543      get { return secondYAxisLogScale; }
    501544      set { secondYAxisLogScale = value; }
     545    }
     546    [Storable(Name = "HistogramBins", DefaultValue = 10)]
     547    private int StorableHistogramBins {
     548      get { return histogramBins; }
     549      set { histogramBins = value; }
     550    }
     551    [Storable(Name = "HistogramExactBins", DefaultValue = false)]
     552    private bool StorableHistogramExactBins {
     553      get { return histogramExactBins; }
     554      set { histogramExactBins = value; }
     555    }
     556    [Storable(Name = "HistogramAggregation", DefaultValue = DataTableHistogramAggregation.Overlapping)]
     557    private DataTableHistogramAggregation StorableHistogramAggregation {
     558      get { return histogramAggregation; }
     559      set { histogramAggregation = value; }
    502560    }
    503561    #endregion
     
    536594      this.yAxisLogScale = original.yAxisLogScale;
    537595      this.secondYAxisLogScale = original.secondYAxisLogScale;
     596      this.histogramBins = original.histogramBins;
     597      this.histogramExactBins = original.histogramExactBins;
     598      this.histogramAggregation = original.histogramAggregation;
    538599    }
    539600    public DataTableVisualProperties() {
     
    565626      this.yAxisLogScale = false;
    566627      this.secondYAxisLogScale = false;
     628      histogramBins = 10;
     629      histogramExactBins = false;
     630      histogramAggregation = DataTableHistogramAggregation.Overlapping;
    567631    }
    568632    public DataTableVisualProperties(string title)
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingDataTableView.cs

    r14381 r15068  
    716716    private void AddPointsToHistogramSeries(Series series, DataRow row, List<double> values) {
    717717      if (!row.Values.Any()) return;
    718       int bins = row.VisualProperties.Bins;
     718      int bins = Content.VisualProperties.HistogramBins;
    719719
    720720      double minValue = GetMinimum(row.Values);
     
    728728
    729729
    730       if (!row.VisualProperties.ExactBins) {
     730      if (!Content.VisualProperties.HistogramExactBins) {
    731731        intervalWidth = HumanRoundRange(intervalWidth);
    732732        minValue = Math.Floor(minValue / intervalWidth) * intervalWidth;
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Analyzers/SymbolicExpressionTreeLengthAnalyzer.cs

    r14185 r15068  
    185185
    186186        treeLengthsTableRow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
    187         treeLengthsTableRow.VisualProperties.ExactBins = false;
     187        treeLengthsTable.VisualProperties.HistogramExactBins = false;
    188188
    189189        int range = maxLength - minLength;
    190190        if (range == 0) range = 1;
    191191        // the following trick should result in an integer intervalWidth of 1,2,4,...
    192         treeLengthsTableRow.VisualProperties.Bins = range;
     192        treeLengthsTable.VisualProperties.HistogramBins = range;
    193193
    194194        if (maxLength <= 25) // [0,25]
Note: See TracChangeset for help on using the changeset viewer.