Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14641 for trunk


Ignore:
Timestamp:
02/03/17 01:21:08 (8 years ago)
Author:
swagner
Message:

#2726: Worked on RunCollectionParameterAnalysisView

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
Files:
2 edited

Legend:

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

    r14636 r14641  
    5858      this.groupsTreeView = new System.Windows.Forms.TreeView();
    5959      this.splitContainer = new System.Windows.Forms.SplitContainer();
     60      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     61      this.parametersGroupBox = new System.Windows.Forms.GroupBox();
     62      this.parametersTreeView = new System.Windows.Forms.TreeView();
    6063      this.groupsGroupBox = new System.Windows.Forms.GroupBox();
    6164      this.removeGroupButton = new System.Windows.Forms.Button();
    6265      this.addGroupButton = new System.Windows.Forms.Button();
    63       this.parametersGroupBox = new System.Windows.Forms.GroupBox();
    64       this.parametersTreeView = new System.Windows.Forms.TreeView();
    6566      this.dataRowsGroupBox = new System.Windows.Forms.GroupBox();
    6667      this.minMaxCheckBox = new System.Windows.Forms.CheckBox();
     
    6869      this.quartilesCheckBox = new System.Windows.Forms.CheckBox();
    6970      this.averageCheckBox = new System.Windows.Forms.CheckBox();
    70       this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    7171      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    7272      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     
    7575      this.splitContainer.Panel2.SuspendLayout();
    7676      this.splitContainer.SuspendLayout();
    77       this.groupsGroupBox.SuspendLayout();
    78       this.parametersGroupBox.SuspendLayout();
    79       this.dataRowsGroupBox.SuspendLayout();
    8077      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    8178      this.splitContainer1.Panel1.SuspendLayout();
    8279      this.splitContainer1.Panel2.SuspendLayout();
    8380      this.splitContainer1.SuspendLayout();
     81      this.parametersGroupBox.SuspendLayout();
     82      this.groupsGroupBox.SuspendLayout();
     83      this.dataRowsGroupBox.SuspendLayout();
    8484      this.SuspendLayout();
    8585      //
     
    124124      title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    125125      title1.Name = "title";
    126       title1.Text = "Title";
    127126      this.chart.Titles.Add(title1);
    128127      this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
     
    175174            | System.Windows.Forms.AnchorStyles.Left)
    176175            | System.Windows.Forms.AnchorStyles.Right)));
     176      this.groupsTreeView.CheckBoxes = true;
    177177      this.groupsTreeView.HideSelection = false;
    178178      this.groupsTreeView.Location = new System.Drawing.Point(6, 49);
     
    181181      this.groupsTreeView.Size = new System.Drawing.Size(255, 524);
    182182      this.groupsTreeView.TabIndex = 2;
     183      this.groupsTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.groupsTreeView_AfterCheck);
    183184      this.groupsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.groupsTreeView_AfterSelect);
    184185      //
     
    203204      this.splitContainer.SplitterDistance = 273;
    204205      this.splitContainer.TabIndex = 0;
     206      //
     207      // splitContainer1
     208      //
     209      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
     210      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     211      this.splitContainer1.Name = "splitContainer1";
     212      this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
     213      //
     214      // splitContainer1.Panel1
     215      //
     216      this.splitContainer1.Panel1.Controls.Add(this.parametersGroupBox);
     217      //
     218      // splitContainer1.Panel2
     219      //
     220      this.splitContainer1.Panel2.Controls.Add(this.groupsGroupBox);
     221      this.splitContainer1.Size = new System.Drawing.Size(273, 851);
     222      this.splitContainer1.SplitterDistance = 261;
     223      this.splitContainer1.TabIndex = 0;
     224      //
     225      // parametersGroupBox
     226      //
     227      this.parametersGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     228            | System.Windows.Forms.AnchorStyles.Left)
     229            | System.Windows.Forms.AnchorStyles.Right)));
     230      this.parametersGroupBox.Controls.Add(this.parametersTreeView);
     231      this.parametersGroupBox.Location = new System.Drawing.Point(3, 3);
     232      this.parametersGroupBox.Name = "parametersGroupBox";
     233      this.parametersGroupBox.Size = new System.Drawing.Size(267, 255);
     234      this.parametersGroupBox.TabIndex = 0;
     235      this.parametersGroupBox.TabStop = false;
     236      this.parametersGroupBox.Text = "&Parameters";
     237      //
     238      // parametersTreeView
     239      //
     240      this.parametersTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     241            | System.Windows.Forms.AnchorStyles.Left)
     242            | System.Windows.Forms.AnchorStyles.Right)));
     243      this.parametersTreeView.CheckBoxes = true;
     244      this.parametersTreeView.HideSelection = false;
     245      this.parametersTreeView.Location = new System.Drawing.Point(6, 19);
     246      this.parametersTreeView.Name = "parametersTreeView";
     247      this.parametersTreeView.ShowRootLines = false;
     248      this.parametersTreeView.Size = new System.Drawing.Size(255, 230);
     249      this.parametersTreeView.TabIndex = 0;
     250      this.parametersTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.parametersTreeView_AfterCheck);
     251      this.parametersTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.parametersTreeView_AfterSelect);
    205252      //
    206253      // groupsGroupBox
     
    241288      this.addGroupButton.Click += new System.EventHandler(this.addGroupButton_Click);
    242289      //
    243       // parametersGroupBox
    244       //
    245       this.parametersGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    246             | System.Windows.Forms.AnchorStyles.Left)
    247             | System.Windows.Forms.AnchorStyles.Right)));
    248       this.parametersGroupBox.Controls.Add(this.parametersTreeView);
    249       this.parametersGroupBox.Location = new System.Drawing.Point(3, 3);
    250       this.parametersGroupBox.Name = "parametersGroupBox";
    251       this.parametersGroupBox.Size = new System.Drawing.Size(267, 255);
    252       this.parametersGroupBox.TabIndex = 0;
    253       this.parametersGroupBox.TabStop = false;
    254       this.parametersGroupBox.Text = "&Parameters";
    255       //
    256       // parametersTreeView
    257       //
    258       this.parametersTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    259             | System.Windows.Forms.AnchorStyles.Left)
    260             | System.Windows.Forms.AnchorStyles.Right)));
    261       this.parametersTreeView.HideSelection = false;
    262       this.parametersTreeView.Location = new System.Drawing.Point(6, 19);
    263       this.parametersTreeView.Name = "parametersTreeView";
    264       this.parametersTreeView.ShowRootLines = false;
    265       this.parametersTreeView.Size = new System.Drawing.Size(255, 230);
    266       this.parametersTreeView.TabIndex = 0;
    267       this.parametersTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.parametersTreeView_AfterSelect);
    268       //
    269290      // dataRowsGroupBox
    270291      //
     
    328349      this.averageCheckBox.UseVisualStyleBackColor = true;
    329350      this.averageCheckBox.CheckedChanged += new System.EventHandler(this.dataRowCheckBox_CheckedChanged);
    330       //
    331       // splitContainer1
    332       //
    333       this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
    334       this.splitContainer1.Location = new System.Drawing.Point(0, 0);
    335       this.splitContainer1.Name = "splitContainer1";
    336       this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
    337       //
    338       // splitContainer1.Panel1
    339       //
    340       this.splitContainer1.Panel1.Controls.Add(this.parametersGroupBox);
    341       //
    342       // splitContainer1.Panel2
    343       //
    344       this.splitContainer1.Panel2.Controls.Add(this.groupsGroupBox);
    345       this.splitContainer1.Size = new System.Drawing.Size(273, 851);
    346       this.splitContainer1.SplitterDistance = 261;
    347       this.splitContainer1.TabIndex = 0;
    348351      //
    349352      // RunCollectionParameterAnalysisView
     
    361364      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    362365      this.splitContainer.ResumeLayout(false);
    363       this.groupsGroupBox.ResumeLayout(false);
    364       this.parametersGroupBox.ResumeLayout(false);
    365       this.dataRowsGroupBox.ResumeLayout(false);
    366       this.dataRowsGroupBox.PerformLayout();
    367366      this.splitContainer1.Panel1.ResumeLayout(false);
    368367      this.splitContainer1.Panel2.ResumeLayout(false);
    369368      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    370369      this.splitContainer1.ResumeLayout(false);
     370      this.parametersGroupBox.ResumeLayout(false);
     371      this.groupsGroupBox.ResumeLayout(false);
     372      this.dataRowsGroupBox.ResumeLayout(false);
     373      this.dataRowsGroupBox.PerformLayout();
    371374      this.ResumeLayout(false);
    372375
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionParameterAnalysisView.cs

    r14640 r14641  
    202202      parametersTreeView.Nodes.Add(paramsRoot);
    203203      paramsRoot.Expand();
     204      paramsRoot.Checked = true;
    204205      parametersTreeView.SelectedNode = paramsRoot;
    205206
     
    244245      chart.Series.Clear();
    245246      chart.Legends[0].CustomItems.Clear();
    246       var selectedNode = groupsTreeView.Focused ? groupsTreeView.SelectedNode : parametersTreeView.SelectedNode;
    247       if (selectedNode == null) return;
    248       if (selectedNode.Parent == null) {
    249         var series = BuildSeries(selectedNode.Tag as IEnumerable<IRun>, colors[0]);
    250         chart.Titles[0].Text = selectedNode.Text;
    251         foreach (var s in series)
    252           chart.Series.Add(s);
    253         var legendItem = new LegendItem();
    254         var legendItemInfo = new LegendItemInfo(colors[0], series);
    255         legendItem.Color = legendItemInfo.Color;
    256         legendItem.BorderColor = Color.Transparent;
    257         legendItem.Name = selectedNode.Text;
    258         legendItem.Tag = legendItemInfo;
    259         chart.Legends[0].CustomItems.Add(legendItem);
    260       } else if (selectedNode.Tag is ParameterInfo) {
    261         var paramInfo = selectedNode.Tag as ParameterInfo;
    262         chart.Titles[0].Text = paramInfo.Name + " (" + paramInfo.RunCount + ")";
    263         foreach (var value in paramInfo.Values) {
    264           var series = BuildSeries(value.Value.Runs, value.Value.Color);
     247      chart.Titles[0].Text = string.Empty;
     248
     249      var checkedNodes = TraverseTreeNodes(parametersTreeView.Nodes)
     250                           .Where(x => x.Checked)
     251                           .Concat(
     252                             TraverseTreeNodes(groupsTreeView.Nodes)
     253                               .Where(x => x.Checked)
     254                           );
     255
     256      foreach (var node in checkedNodes) {
     257        if (node.Parent == null) {
     258          var series = BuildSeries(node.Tag as IEnumerable<IRun>, colors[0]);
     259          chart.Titles[0].Text = node.Text;
    265260          foreach (var s in series)
    266261            chart.Series.Add(s);
    267262          var legendItem = new LegendItem();
    268           var legendItemInfo = new LegendItemInfo(value.Value.Color, series);
     263          var legendItemInfo = new LegendItemInfo(colors[0], series);
    269264          legendItem.Color = legendItemInfo.Color;
    270265          legendItem.BorderColor = Color.Transparent;
    271           legendItem.Name = value.Key + " (" + value.Value.RunCount + ")";
     266          legendItem.Name = node.Text;
    272267          legendItem.Tag = legendItemInfo;
    273268          chart.Legends[0].CustomItems.Add(legendItem);
    274         }
    275       } else if (selectedNode.Tag is ParameterValueInfo) {
    276         var valueInfo = selectedNode.Tag as ParameterValueInfo;
    277         var series = BuildSeries(valueInfo.Runs, valueInfo.Color);
    278         chart.Titles[0].Text = selectedNode.Parent.Text;
    279         foreach (var s in series)
    280           chart.Series.Add(s);
    281         var legendItem = new LegendItem();
    282         var legendItemInfo = new LegendItemInfo(valueInfo.Color, series);
    283         legendItem.Color = legendItemInfo.Color;
    284         legendItem.BorderColor = Color.Transparent;
    285         legendItem.Name = selectedNode.Text;
    286         legendItem.Tag = legendItemInfo;
    287         chart.Legends[0].CustomItems.Add(legendItem);
    288       } else if (selectedNode.Tag is GroupInfo) {
    289         var groupInfo = selectedNode.Tag as GroupInfo;
    290         if (groupInfo.IsParameter) {
    291           chart.Titles[0].Text = groupInfo.Text + " (" + groupInfo.Runs.Count + ")";
    292           foreach (TreeNode node in selectedNode.Nodes) {
    293             var childInfo = node.Tag as GroupInfo;
    294             var series = BuildSeries(childInfo.Runs, childInfo.Color);
     269        } else if (node.Tag is ParameterInfo) {
     270          var paramInfo = node.Tag as ParameterInfo;
     271          chart.Titles[0].Text = paramInfo.Name + " (" + paramInfo.RunCount + ")";
     272          foreach (var value in paramInfo.Values) {
     273            var series = BuildSeries(value.Value.Runs, value.Value.Color);
    295274            foreach (var s in series)
    296275              chart.Series.Add(s);
    297276            var legendItem = new LegendItem();
    298             var legendItemInfo = new LegendItemInfo(childInfo.Color, series);
     277            var legendItemInfo = new LegendItemInfo(value.Value.Color, series);
    299278            legendItem.Color = legendItemInfo.Color;
    300279            legendItem.BorderColor = Color.Transparent;
    301             legendItem.Name = childInfo.Text + " (" + childInfo.Runs.Count + ")";
     280            legendItem.Name = value.Key + " (" + value.Value.RunCount + ")";
    302281            legendItem.Tag = legendItemInfo;
    303282            chart.Legends[0].CustomItems.Add(legendItem);
    304283          }
    305         } else {
    306           var parentInfo = selectedNode.Parent.Tag as GroupInfo;
    307           chart.Titles[0].Text = parentInfo.Text + " (" + parentInfo.Runs.Count + ")";
    308           var series = BuildSeries(groupInfo.Runs, groupInfo.Color);
     284        } else if (node.Tag is ParameterValueInfo) {
     285          var valueInfo = node.Tag as ParameterValueInfo;
     286          var series = BuildSeries(valueInfo.Runs, valueInfo.Color);
     287          chart.Titles[0].Text = node.Parent.Text;
    309288          foreach (var s in series)
    310289            chart.Series.Add(s);
    311290          var legendItem = new LegendItem();
    312           var legendItemInfo = new LegendItemInfo(groupInfo.Color, series);
     291          var legendItemInfo = new LegendItemInfo(valueInfo.Color, series);
    313292          legendItem.Color = legendItemInfo.Color;
    314293          legendItem.BorderColor = Color.Transparent;
    315           legendItem.Name = groupInfo.Text + " (" + groupInfo.Runs.Count + ")";
     294          legendItem.Name = node.Text;
    316295          legendItem.Tag = legendItemInfo;
    317296          chart.Legends[0].CustomItems.Add(legendItem);
     297        } else if (node.Tag is GroupInfo) {
     298          var groupInfo = node.Tag as GroupInfo;
     299          if (groupInfo.IsParameter) {
     300            chart.Titles[0].Text = groupInfo.Text + " (" + groupInfo.Runs.Count + ")";
     301            foreach (TreeNode child in node.Nodes) {
     302              var childInfo = child.Tag as GroupInfo;
     303              var series = BuildSeries(childInfo.Runs, childInfo.Color);
     304              foreach (var s in series)
     305                chart.Series.Add(s);
     306              var legendItem = new LegendItem();
     307              var legendItemInfo = new LegendItemInfo(childInfo.Color, series);
     308              legendItem.Color = legendItemInfo.Color;
     309              legendItem.BorderColor = Color.Transparent;
     310              legendItem.Name = childInfo.Text + " (" + childInfo.Runs.Count + ")";
     311              legendItem.Tag = legendItemInfo;
     312              chart.Legends[0].CustomItems.Add(legendItem);
     313            }
     314          } else {
     315            var parentInfo = node.Parent.Tag as GroupInfo;
     316            chart.Titles[0].Text = parentInfo.Text + " (" + parentInfo.Runs.Count + ")";
     317            var series = BuildSeries(groupInfo.Runs, groupInfo.Color);
     318            foreach (var s in series)
     319              chart.Series.Add(s);
     320            var legendItem = new LegendItem();
     321            var legendItemInfo = new LegendItemInfo(groupInfo.Color, series);
     322            legendItem.Color = legendItemInfo.Color;
     323            legendItem.BorderColor = Color.Transparent;
     324            legendItem.Name = groupInfo.Text + " (" + groupInfo.Runs.Count + ")";
     325            legendItem.Tag = legendItemInfo;
     326            chart.Legends[0].CustomItems.Add(legendItem);
     327          }
    318328        }
    319329      }
     
    474484    #region parametersTreeView
    475485    private void parametersTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
     486      addGroupButton.Enabled = (parametersTreeView.SelectedNode != null) && (parametersTreeView.SelectedNode.Parent != null);
     487    }
     488    private void parametersTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
    476489      UpdateChart();
    477       addGroupButton.Enabled = (parametersTreeView.SelectedNode != null) && (parametersTreeView.SelectedNode.Parent != null);
    478490    }
    479491    #endregion
    480492    #region groupsTreeView
    481493    private void groupsTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
     494      removeGroupButton.Enabled = (groupsTreeView.SelectedNode != null) && (groupsTreeView.SelectedNode.Parent != null);
     495    }
     496    private void groupsTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
    482497      UpdateChart();
    483       removeGroupButton.Enabled = (groupsTreeView.SelectedNode != null) && (groupsTreeView.SelectedNode.Parent != null);
    484498    }
    485499    #endregion
     
    493507        var paramInfo = param.Tag as ParameterInfo;
    494508        var paramNode = new TreeNode();
    495         int count = 0;
    496509        foreach (var valueInfo in paramInfo.Values.Values) {
    497           var runs = groupRuns.Intersect(valueInfo.Runs);
    498           var valueNode = new TreeNode(valueInfo.Value + " (" + runs.Count() + ")");
    499           count += runs.Count();
    500           valueNode.Tag = new GroupInfo(valueInfo.Value, valueInfo.Color, runs, false);
     510          var valueRuns = groupRuns.Intersect(valueInfo.Runs);
     511          var valueNode = new TreeNode(valueInfo.Value + " (" + valueRuns.Count() + ")");
     512          valueNode.Tag = new GroupInfo(valueInfo.Value, valueInfo.Color, valueRuns, false);
    501513          paramNode.Nodes.Add(valueNode);
    502514        }
    503         paramNode.Text = paramInfo.Name + " (" + count + ")";
    504         paramNode.Tag = new GroupInfo(paramInfo.Name, Color.Empty, paramInfo.Values.Values.SelectMany(x => x.Runs), true);
     515        var paramRuns = groupRuns.Intersect(paramInfo.Runs);
     516        paramNode.Text = paramInfo.Name + " (" + paramRuns.Count() + ")";
     517        paramNode.Tag = new GroupInfo(paramInfo.Name, Color.Empty, paramRuns, true);
    505518        group.Nodes.Add(paramNode);
    506519      } else if (param.Tag is ParameterValueInfo) {
    507520        var paramInfo = param.Parent.Tag as ParameterInfo;
    508521        var valueInfo = param.Tag as ParameterValueInfo;
    509         var runs = groupRuns.Intersect(valueInfo.Runs);
    510         var paramNode = new TreeNode(paramInfo.Name + " (" + runs.Count() + ")");
    511         var valueNode = new TreeNode(valueInfo.Value + " (" + runs.Count() + ")");
    512         valueNode.Tag = new GroupInfo(valueInfo.Value, valueInfo.Color, runs, false);
    513         paramNode.Tag = new GroupInfo(paramInfo.Name, Color.Empty, runs, true);
     522        var valueRuns = groupRuns.Intersect(valueInfo.Runs);
     523        var paramRuns = groupRuns.Intersect(paramInfo.Runs);
     524        var paramNode = new TreeNode(paramInfo.Name + " (" + paramRuns.Count() + ")");
     525        var valueNode = new TreeNode(valueInfo.Value + " (" + valueRuns.Count() + ")");
     526        valueNode.Tag = new GroupInfo(valueInfo.Value, valueInfo.Color, valueRuns, false);
     527        paramNode.Tag = new GroupInfo(paramInfo.Name, Color.Empty, paramRuns, true);
    514528        paramNode.Nodes.Add(valueNode);
    515529        group.Nodes.Add(paramNode);
     
    528542    }
    529543    #endregion
     544    #endregion
     545
     546    #region Helpers
     547    private IEnumerable<TreeNode> TraverseTreeNodes(TreeNodeCollection nodes) {
     548      foreach (var node in nodes.OfType<TreeNode>()) {
     549        yield return node;
     550        foreach (var child in TraverseTreeNodes(node.Nodes))
     551          yield return child;
     552      }
     553    }
    530554    #endregion
    531555
Note: See TracChangeset for help on using the changeset viewer.