Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5330 for trunk


Ignore:
Timestamp:
01/19/11 13:19:28 (14 years ago)
Author:
mkommend
Message:

ticket #1056

  • Changed combobox events from SelectedIndexChanged to SelectedValueChanged
  • Changed series type from Bubbles to Points as this improves the performance of the chart as cneumuel suggested.
  • Added trackbar to change the maximum marker size.
Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.Designer.cs

    r5287 r5330  
    6868      this.tooltip = new System.Windows.Forms.ToolTip(this.components);
    6969      this.colorXAxisButton = new System.Windows.Forms.Button();
     70      this.colorYAxisButton = new System.Windows.Forms.Button();
    7071      this.noRunsLabel = new System.Windows.Forms.Label();
    71       this.colorYAxisButton = new System.Windows.Forms.Button();
     72      this.sizeTrackBar = new System.Windows.Forms.TrackBar();
    7273      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    7374      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
    7475      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    7576      this.radioButtonGroup.SuspendLayout();
     77      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).BeginInit();
    7678      this.SuspendLayout();
    7779      //
     
    7981      //
    8082      this.yJitterLabel.AutoSize = true;
    81       this.yJitterLabel.Location = new System.Drawing.Point(350, 6);
     83      this.yJitterLabel.Location = new System.Drawing.Point(278, 6);
    8284      this.yJitterLabel.Name = "yJitterLabel";
    8385      this.yJitterLabel.Size = new System.Drawing.Size(32, 13);
     
    8991      this.xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    9092      this.xJitterlabel.AutoSize = true;
    91       this.xJitterlabel.Location = new System.Drawing.Point(635, 316);
     93      this.xJitterlabel.Location = new System.Drawing.Point(749, 472);
    9294      this.xJitterlabel.Name = "xJitterlabel";
    9395      this.xJitterlabel.Size = new System.Drawing.Size(32, 13);
     
    99101      this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    100102      this.xTrackBar.Enabled = false;
    101       this.xTrackBar.Location = new System.Drawing.Point(673, 313);
     103      this.xTrackBar.Location = new System.Drawing.Point(787, 469);
    102104      this.xTrackBar.Maximum = 100;
    103105      this.xTrackBar.Name = "xTrackBar";
     
    111113      this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    112114      this.xAxisLabel.AutoSize = true;
    113       this.xAxisLabel.Location = new System.Drawing.Point(357, 316);
     115      this.xAxisLabel.Location = new System.Drawing.Point(471, 472);
    114116      this.xAxisLabel.Name = "xAxisLabel";
    115117      this.xAxisLabel.Size = new System.Drawing.Size(15, 13);
     
    123125      this.xAxisComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    124126      this.xAxisComboBox.FormattingEnabled = true;
    125       this.xAxisComboBox.Location = new System.Drawing.Point(378, 313);
     127      this.xAxisComboBox.Location = new System.Drawing.Point(492, 469);
    126128      this.xAxisComboBox.Name = "xAxisComboBox";
    127129      this.xAxisComboBox.Size = new System.Drawing.Size(221, 21);
    128130      this.xAxisComboBox.TabIndex = 7;
    129       this.xAxisComboBox.SelectedIndexChanged += new System.EventHandler(this.AxisComboBox_SelectedIndexChanged);
     131      this.xAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
    130132      //
    131133      // yAxisLabel
     
    147149      this.yAxisComboBox.Size = new System.Drawing.Size(221, 21);
    148150      this.yAxisComboBox.TabIndex = 5;
    149       this.yAxisComboBox.SelectedIndexChanged += new System.EventHandler(this.AxisComboBox_SelectedIndexChanged);
     151      this.yAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
    150152      //
    151153      // yTrackBar
    152154      //
    153155      this.yTrackBar.Enabled = false;
    154       this.yTrackBar.Location = new System.Drawing.Point(388, 3);
     156      this.yTrackBar.Location = new System.Drawing.Point(312, 3);
    155157      this.yTrackBar.Maximum = 100;
    156158      this.yTrackBar.Name = "yTrackBar";
     
    166168      this.sizeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    167169      this.sizeComboBox.FormattingEnabled = true;
    168       this.sizeComboBox.Location = new System.Drawing.Point(514, 3);
     170      this.sizeComboBox.Location = new System.Drawing.Point(560, 4);
    169171      this.sizeComboBox.Name = "sizeComboBox";
    170172      this.sizeComboBox.Size = new System.Drawing.Size(221, 21);
    171173      this.sizeComboBox.TabIndex = 14;
    172       this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.AxisComboBox_SelectedIndexChanged);
     174      this.sizeComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
    173175      //
    174176      // sizeLabel
     
    176178      this.sizeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    177179      this.sizeLabel.AutoSize = true;
    178       this.sizeLabel.Location = new System.Drawing.Point(444, 6);
     180      this.sizeLabel.Location = new System.Drawing.Point(489, 7);
    179181      this.sizeLabel.Name = "sizeLabel";
    180182      this.sizeLabel.Size = new System.Drawing.Size(66, 13);
     
    192194      this.chart.Name = "chart";
    193195      series2.ChartArea = "ChartArea1";
    194       series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Bubble;
    195       series2.CustomProperties = "BubbleMinSize=2, BubbleMaxSize=7";
     196      series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
    196197      series2.IsVisibleInLegend = false;
    197198      series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
     
    199200      series2.YValuesPerPoint = 2;
    200201      this.chart.Series.Add(series2);
    201       this.chart.Size = new System.Drawing.Size(729, 269);
     202      this.chart.Size = new System.Drawing.Size(843, 425);
    202203      this.chart.TabIndex = 16;
    203204      this.chart.Text = "chart";
     
    244245      this.radioButtonGroup.Controls.Add(this.zoomButton);
    245246      this.radioButtonGroup.Controls.Add(this.selectButton);
    246       this.radioButtonGroup.Location = new System.Drawing.Point(3, 305);
     247      this.radioButtonGroup.Location = new System.Drawing.Point(3, 461);
    247248      this.radioButtonGroup.Name = "radioButtonGroup";
    248249      this.radioButtonGroup.Size = new System.Drawing.Size(135, 32);
     
    255256      this.colorButton.Enabled = false;
    256257      this.colorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    257       this.colorButton.Location = new System.Drawing.Point(144, 313);
     258      this.colorButton.Location = new System.Drawing.Point(144, 469);
    258259      this.colorButton.Name = "colorButton";
    259260      this.colorButton.Size = new System.Drawing.Size(64, 21);
     
    273274      this.colorXAxisButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    274275      this.colorXAxisButton.Enabled = false;
    275       this.colorXAxisButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.DisplayInColor;
    276       this.colorXAxisButton.Location = new System.Drawing.Point(605, 313);
     276      this.colorXAxisButton.Image = ((System.Drawing.Image)(resources.GetObject("colorXAxisButton.Image")));
     277      this.colorXAxisButton.Location = new System.Drawing.Point(719, 469);
    277278      this.colorXAxisButton.Name = "colorXAxisButton";
    278279      this.colorXAxisButton.Size = new System.Drawing.Size(21, 21);
     
    282283      this.colorXAxisButton.Click += new System.EventHandler(this.colorXAxisButton_Click);
    283284      //
    284       // noRunsLabel
    285       //
    286       this.noRunsLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
    287       this.noRunsLabel.AutoSize = true;
    288       this.noRunsLabel.Location = new System.Drawing.Point(309, 150);
    289       this.noRunsLabel.Name = "noRunsLabel";
    290       this.noRunsLabel.Size = new System.Drawing.Size(138, 13);
    291       this.noRunsLabel.TabIndex = 21;
    292       this.noRunsLabel.Text = "No runs could be displayed.";
    293       //
    294285      // colorYAxisButton
    295286      //
    296287      this.colorYAxisButton.Enabled = false;
    297       this.colorYAxisButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.DisplayInColor;
     288      this.colorYAxisButton.Image = ((System.Drawing.Image)(resources.GetObject("colorYAxisButton.Image")));
    298289      this.colorYAxisButton.Location = new System.Drawing.Point(251, 3);
    299290      this.colorYAxisButton.Name = "colorYAxisButton";
     
    304295      this.colorYAxisButton.Click += new System.EventHandler(this.colorYAxisButton_Click);
    305296      //
     297      // noRunsLabel
     298      //
     299      this.noRunsLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
     300      this.noRunsLabel.AutoSize = true;
     301      this.noRunsLabel.Location = new System.Drawing.Point(366, 228);
     302      this.noRunsLabel.Name = "noRunsLabel";
     303      this.noRunsLabel.Size = new System.Drawing.Size(138, 13);
     304      this.noRunsLabel.TabIndex = 21;
     305      this.noRunsLabel.Text = "No runs could be displayed.";
     306      //
     307      // sizeTrackBar
     308      //
     309      this.sizeTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     310      this.sizeTrackBar.Location = new System.Drawing.Point(787, 3);
     311      this.sizeTrackBar.Maximum = 50;
     312      this.sizeTrackBar.Minimum = 5;
     313      this.sizeTrackBar.Name = "sizeTrackBar";
     314      this.sizeTrackBar.Size = new System.Drawing.Size(64, 45);
     315      this.sizeTrackBar.TabIndex = 24;
     316      this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     317      this.sizeTrackBar.Value = 50;
     318      this.sizeTrackBar.ValueChanged += new System.EventHandler(this.sizeTrackBar_ValueChanged);
     319      //
    306320      // RunCollectionBubbleChartView
    307321      //
     
    310324      this.BackColor = System.Drawing.SystemColors.Window;
    311325      this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     326      this.Controls.Add(this.sizeTrackBar);
    312327      this.Controls.Add(this.colorYAxisButton);
    313328      this.Controls.Add(this.colorXAxisButton);
     
    327342      this.Controls.Add(this.yTrackBar);
    328343      this.Name = "RunCollectionBubbleChartView";
    329       this.Size = new System.Drawing.Size(740, 340);
     344      this.Size = new System.Drawing.Size(854, 496);
    330345      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();
    331346      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit();
     
    333348      this.radioButtonGroup.ResumeLayout(false);
    334349      this.radioButtonGroup.PerformLayout();
     350      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).EndInit();
    335351      this.ResumeLayout(false);
    336352      this.PerformLayout();
     
    360376    private System.Windows.Forms.Button colorXAxisButton;
    361377    private System.Windows.Forms.Button colorYAxisButton;
     378    private System.Windows.Forms.TrackBar sizeTrackBar;
    362379  }
    363380}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r4888 r5330  
    231231          this.AddDataPoint(run);
    232232
    233         //check to correct max bubble size
    234         if (this.chart.Series[0].Points.Select(p => p.YValues[1]).Distinct().Count() == 1)
    235           this.chart.Series[0]["BubbleMaxSize"] = "2";
    236         else
    237           this.chart.Series[0]["BubbleMaxSize"] = "7";
     233        ////check to correct max bubble size
     234        //if (this.chart.Series[0].Points.Select(p => p.YValues[1]).Distinct().Count() == 1)
     235        //  this.chart.Series[0]["BubbleMaxSize"] = "2";
     236        //else
     237        //  this.chart.Series[0]["BubbleMaxSize"] = "7";
    238238
    239239        if (this.chart.Series[0].Points.Count == 0)
     
    241241        else {
    242242          noRunsLabel.Visible = false;
     243          UpdateMarkerSizes();
    243244          UpdateCursorInterval();
    244245        }
    245246      }
    246247    }
     248
     249    private void UpdateMarkerSizes() {
     250      double[] sizeValues = this.chart.Series[0].Points.Select(p => p.YValues[1]).ToArray();
     251      double minSizeValue = sizeValues.Min();
     252      double maxSizeValue = sizeValues.Max();
     253
     254      if (maxSizeValue - minSizeValue < double.Epsilon) return;
     255
     256      for (int i = 0; i < sizeValues.Length; i++) {
     257        DataPoint point = this.chart.Series[0].Points[i];
     258        double relativeSize = (point.YValues[1] - minSizeValue) / (maxSizeValue - minSizeValue);
     259        point.MarkerSize = (int)Math.Round((sizeTrackBar.Value - sizeTrackBar.Minimum) * relativeSize + sizeTrackBar.Minimum);
     260      }
     261
     262    }
     263
    247264    private void AddDataPoint(IRun run) {
    248265      double? xValue;
     
    517534      this.UpdateDataPoints();
    518535    }
    519 
    520     private void AxisComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     536    private void sizeTrackBar_ValueChanged(object sender, EventArgs e) {
     537      UpdateMarkerSizes();
     538    }
     539
     540    private void AxisComboBox_SelectedValueChanged(object sender, EventArgs e) {
    521541      bool axisSelected = xAxisComboBox.SelectedIndex != -1 && yAxisComboBox.SelectedIndex != -1;
    522542      xTrackBar.Enabled = yTrackBar.Enabled = axisSelected;
Note: See TracChangeset for help on using the changeset viewer.