Changeset 1106
- Timestamp:
- 01/09/09 18:05:03 (16 years ago)
- Location:
- branches/CEDMA-Refactoring-Ticket419
- Files:
-
- 7 added
- 9 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChart.cs
r573 r1106 27 27 using HeuristicLab.Charting; 28 28 using System.Windows.Forms; 29 using HeuristicLab.CEDMA.Core; 29 30 30 31 namespace HeuristicLab.CEDMA.Charting { … … 50 51 private double maxY = double.NegativeInfinity; 51 52 private List<Record> records; 52 private Result Listresults;53 private Results results; 53 54 private Dictionary<IPrimitive, Record> primitiveToRecordDictionary; 54 55 private Dictionary<Record, IPrimitive> recordToPrimitiveDictionary; … … 56 57 private Group points; 57 58 58 public BubbleChart(Result Listresults, PointD lowerLeft, PointD upperRight)59 public BubbleChart(Results results, PointD lowerLeft, PointD upperRight) 59 60 : base(lowerLeft, upperRight) { 60 61 records = new List<Record>(); -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj
r1075 r1106 66 66 </ItemGroup> 67 67 <ItemGroup> 68 <Compile Include="BubbleChart.cs" />69 <Compile Include="BubbleChartControl.cs">70 <SubType>UserControl</SubType>71 </Compile>72 <Compile Include="BubbleChartControl.Designer.cs">73 <DependentUpon>BubbleChartControl.cs</DependentUpon>74 </Compile>75 <Compile Include="Histogram.cs" />76 <Compile Include="HistogramControl.cs">77 <SubType>UserControl</SubType>78 </Compile>79 <Compile Include="HistogramControl.Designer.cs">80 <DependentUpon>HistogramControl.cs</DependentUpon>81 </Compile>82 <Compile Include="ModelView.cs">83 <SubType>UserControl</SubType>84 </Compile>85 <Compile Include="ModelView.Designer.cs">86 <DependentUpon>ModelView.cs</DependentUpon>87 </Compile>88 68 <Compile Include="HeuristicLabCedmaChartingPlugin.cs" /> 89 69 <Compile Include="Properties\AssemblyInfo.cs" /> 90 70 </ItemGroup> 91 71 <ItemGroup> 72 <ProjectReference Include="..\HeuristicLab.CEDMA.Core\HeuristicLab.CEDMA.Core.csproj"> 73 <Project>{C27DDF6C-84DF-45EF-B82F-57A28DD51166}</Project> 74 <Name>HeuristicLab.CEDMA.Core</Name> 75 </ProjectReference> 92 76 <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj"> 93 77 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> … … 135 119 <None Include="Properties\AssemblyInfo.frame" /> 136 120 </ItemGroup> 137 <ItemGroup>138 <EmbeddedResource Include="BubbleChartControl.resx">139 <DependentUpon>BubbleChartControl.cs</DependentUpon>140 <SubType>Designer</SubType>141 </EmbeddedResource>142 <EmbeddedResource Include="HistogramControl.resx">143 <DependentUpon>HistogramControl.cs</DependentUpon>144 <SubType>Designer</SubType>145 </EmbeddedResource>146 <EmbeddedResource Include="ModelView.resx">147 <DependentUpon>ModelView.cs</DependentUpon>148 <SubType>Designer</SubType>149 </EmbeddedResource>150 </ItemGroup>151 121 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 152 122 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Console.cs
r957 r1106 29 29 using System.ServiceModel.Description; 30 30 using HeuristicLab.CEDMA.DB.Interfaces; 31 using HeuristicLab.CEDMA.Charting;32 31 33 32 namespace HeuristicLab.CEDMA.Core { -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSet.cs
r1073 r1106 88 88 Results results = new Results(Store); 89 89 results.FilterDataSet(new Entity(Ontology.CedmaNameSpace + Guid)); 90 return results; 90 91 } 91 92 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.Designer.cs
r1073 r1106 75 75 // resultsButton 76 76 // 77 this.resultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 77 78 this.resultsButton.Location = new System.Drawing.Point(84, 128); 78 79 this.resultsButton.Name = "resultsButton"; -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.cs
r1075 r1106 64 64 private void resultsButton_Click(object sender, EventArgs e) { 65 65 Results results = dataSet.GetResults(); 66 IControl resultsControl = (IControl)results.CreateView();66 IControl resultsControl = new ResultsViewContainer(results); 67 67 PluginManager.ControlManager.ShowControl(resultsControl); 68 68 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
r1075 r1106 72 72 </ItemGroup> 73 73 <ItemGroup> 74 <Compile Include="TableResultsView.cs"> 75 <SubType>UserControl</SubType> 76 </Compile> 77 <Compile Include="TableResultsView.Designer.cs"> 78 <DependentUpon>TableResultsView.cs</DependentUpon> 79 </Compile> 74 80 <Compile Include="Console.cs" /> 75 81 <Compile Include="ConsoleEditor.cs"> 76 82 <SubType>UserControl</SubType> 77 83 </Compile> 84 <Compile Include="IResultsView.cs" /> 78 85 <Compile Include="Problem.cs" /> 79 86 <Compile Include="DataSet.cs" /> … … 101 108 <Compile Include="ProblemInjector.cs" /> 102 109 <Compile Include="Results.cs" /> 103 <Compile Include="ResultsView .cs">110 <Compile Include="ResultsViewContainer.cs"> 104 111 <SubType>UserControl</SubType> 105 112 </Compile> 106 <Compile Include="ResultsView .Designer.cs">107 <DependentUpon>ResultsView .cs</DependentUpon>113 <Compile Include="ResultsViewContainer.Designer.cs"> 114 <DependentUpon>ResultsViewContainer.cs</DependentUpon> 108 115 </Compile> 109 116 </ItemGroup> … … 112 119 </ItemGroup> 113 120 <ItemGroup> 114 <ProjectReference Include="..\HeuristicLab.CEDMA.Charting\HeuristicLab.CEDMA.Charting.csproj">115 <Project>{1BF17271-5350-476A-8F6D-FC74FA3E82CA}</Project>116 <Name>HeuristicLab.CEDMA.Charting</Name>117 </ProjectReference>118 121 <ProjectReference Include="..\HeuristicLab.CEDMA.DB.Interfaces\HeuristicLab.CEDMA.DB.Interfaces.csproj"> 119 122 <Project>{4F9BB789-D561-436B-B226-2BF44B7D0804}</Project> … … 142 145 </ItemGroup> 143 146 <ItemGroup> 147 <EmbeddedResource Include="TableResultsView.resx"> 148 <DependentUpon>TableResultsView.cs</DependentUpon> 149 </EmbeddedResource> 144 150 <EmbeddedResource Include="ConsoleEditor.resx"> 145 151 <DependentUpon>ConsoleEditor.cs</DependentUpon> … … 155 161 <DependentUpon>ProblemView.cs</DependentUpon> 156 162 </EmbeddedResource> 157 <EmbeddedResource Include="ResultsView .resx">158 <DependentUpon>ResultsView .cs</DependentUpon>163 <EmbeddedResource Include="ResultsViewContainer.resx"> 164 <DependentUpon>ResultsViewContainer.cs</DependentUpon> 159 165 </EmbeddedResource> 160 166 </ItemGroup> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs
r1075 r1106 36 36 37 37 namespace HeuristicLab.CEDMA.Core { 38 public class Results : IViewable, IEnumerable<Record> { 39 private Dictionary<Record, Dataset> datasets; 38 public class Results { 39 public static string[] CategoricalVariables { 40 get { return new string[] { "TargetVariable" }; } 41 } 42 43 public static string[] OrdinalVariables { 44 get { return new string[] { "ValidationMeanAbsolutePercentageError" }; } 45 } 40 46 41 47 private IStore store; … … 47 53 } 48 54 49 private void ReloadList() { 50 var results = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree)) 51 .Select(x => store.Select(new SelectFilter( 52 new Entity[] { new Entity(x.Subject.Uri) }, 53 new Entity[] { Ontology.PredicateModelAttribute }, 54 new Resource[] { Ontology.AnyEntity }))); 55 private Entity dataSetEntity; 56 57 public Results(IStore store) { 58 this.store = store; 59 } 60 61 internal void FilterDataSet(Entity entity) { 62 this.dataSetEntity = entity; 63 } 64 65 internal IEnumerable<object[]> SelectRows(List<string> columnNames) { 66 if (store == null) yield return null; 67 68 Resource[] columnNamesRes = columnNames.Select(x => new Literal(x)).ToArray(); 69 70 var results = store.Select(new Statement(dataSetEntity, Ontology.PredicateHasModel, Ontology.AnyEntity)) 71 .SelectMany(x => store.Select(new SelectFilter( 72 new Entity[] { (Entity)x.Property }, 73 new Entity[] { Ontology.PredicateModelAttribute }, 74 new Resource[] { Ontology.AnyEntity }))) 75 .SelectMany(x => 76 store.Select( 77 new SelectFilter( 78 new Entity[] { (Entity)x.Property }, 79 new Entity[] { Ontology.PredicateModelAttributeName }, 80 columnNamesRes)).Select(y => 81 new { 82 Model = x.Subject, 83 Attribute = (Entity)x.Property, 84 AttributeName = (Literal)y.Property 85 })) 86 .SelectMany(x => 87 store.Select( 88 new Statement(x.Attribute, Ontology.PredicateModelAttributeValue, Ontology.AnyEntity)) 89 .Select(y => 90 new { 91 Model = x.Model.Uri, 92 AttributeName = x.AttributeName.Value, 93 AttributeValue = ((Literal)y.Property).Value 94 })).GroupBy(x=>x.Model); 95 55 96 56 97 Random random = new Random(); 57 foreach(Statement[] ss in results) { 58 if(ss.Length > 0) { 59 Record r = new Record(this, ss[0].Subject.Uri); 60 r.Set(Record.X_JITTER, random.NextDouble() * 2.0 - 1.0); 61 r.Set(Record.Y_JITTER, random.NextDouble() * 2.0 - 1.0); 62 foreach(Statement s in ss) { 63 string varName; 64 predicateToVariableName.TryGetValue(s.Predicate, out varName); 65 if(varName != null) { 66 if(varName == Record.TREE_HEIGHT || varName == Record.TREE_SIZE || varName == Record.TARGET_VARIABLE) { 67 r.Set(varName, (double)(int)((Literal)s.Property).Value); 68 } else { 69 r.Set(varName, (double)((Literal)s.Property).Value); 70 } 71 } 72 } 73 lock(records) { 74 records.Add(r); 75 } 76 FireRecordAdded(r); 77 } 98 foreach (var row in results) { 99 100 yield return row.Select(x => x.AttributeValue).ToArray(); 101 //if (ss.Length > 0) { 102 // Record r = new Record(this, ss[0].Subject.Uri); 103 // r.Set(Record.X_JITTER, random.NextDouble() * 2.0 - 1.0); 104 // r.Set(Record.Y_JITTER, random.NextDouble() * 2.0 - 1.0); 105 // foreach (Statement s in ss) { 106 // string varName; 107 // predicateToVariableName.TryGetValue(s.Predicate, out varName); 108 // if (varName != null) { 109 // if (varName == Record.TREE_HEIGHT || varName == Record.TREE_SIZE || varName == Record.TARGET_VARIABLE) { 110 // r.Set(varName, (double)(int)((Literal)s.Property).Value); 111 // } else { 112 // r.Set(varName, (double)((Literal)s.Property).Value); 113 // } 114 // } 115 // } 116 //} 78 117 } 79 FireChanged();80 118 } 81 82 public Results(IStore store)83 : base() {84 this.store = store;85 records = new List<Record>();86 datasets = new Dictionary<Record, Dataset>();87 //predicateToVariableName = new Dictionary<Entity, string>();88 //predicateToVariableName[targetVariablePredicate] = Record.TARGET_VARIABLE;89 //predicateToVariableName[treeSizePredicate] = Record.TREE_SIZE;90 //predicateToVariableName[treeHeightPredicate] = Record.TREE_HEIGHT;91 //predicateToVariableName[selectionPressurePredicate] = Record.SELECTIONPRESSURE;92 //predicateToVariableName[trainingMAPEPredicate] = Record.MAPE_TRAINING;93 //predicateToVariableName[validationMAPEPredicate] = Record.MAPE_VALIDATION;94 //predicateToVariableName[testMAPEPredicate] = Record.MAPE_TEST;95 //predicateToVariableName[trainingR2Predicate] = Record.R2_TRAINING;96 //predicateToVariableName[validationR2Predicate] = Record.R2_VALIDATION;97 //predicateToVariableName[testR2Predicate] = Record.R2_TEST;98 }99 100 public override IView CreateView() {101 return new ResultsView(this);102 }103 104 //internal void OpenModel(Record record) {105 // IList<Statement> modelResults = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateSerializedData, Ontology.AnyEntity));106 // if(modelResults.Count == 1) {107 // string rawData = ((SerializedLiteral)modelResults[0].Property).RawData;108 // XmlDocument doc = new XmlDocument();109 // doc.LoadXml(rawData);110 // IFunctionTree tree = (IFunctionTree)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());111 // int targetVariable = (int)record.Get(Record.TARGET_VARIABLE);112 // Dataset dataset = GetDataset(record);113 114 // ModelView modelView = new ModelView(record, dataset, tree, targetVariable);115 // PluginManager.ControlManager.ShowControl(modelView);116 // }117 //}118 119 //private Dataset GetDataset(Record record) {120 // if(!datasets.ContainsKey(record)) {121 // IList<Statement> result = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateHasModel, new Entity(record.Uri)));122 // if(result.Count == 1) {123 // IList<Statement> datasetResult = store.Select(new Statement(result[0].Subject, Ontology.PredicateSerializedData, Ontology.AnyEntity));124 // if(datasetResult.Count == 1) {125 // string rawData = ((SerializedLiteral)datasetResult[0].Property).RawData;126 // XmlDocument doc = new XmlDocument();127 // doc.LoadXml(rawData);128 // Dataset dataset = (Dataset)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());129 // datasets.Add(record, dataset);130 // }131 // }132 // }133 // return datasets[record];134 //}135 136 //internal void OpenAlgorithm(Record record) {137 // IList<Statement> generatedBy = store.Select(new Statement(new Entity(record.Uri), Ontology.PredicateGeneratedBy, Ontology.AnyEntity));138 // if(generatedBy.Count == 1) {139 // IList<Statement> algoResult = store.Select(new Statement((Entity)generatedBy[0].Property, Ontology.PredicateSerializedData, Ontology.AnyEntity));140 // if(algoResult.Count == 1) {141 // string rawData = ((SerializedLiteral)algoResult[0].Property).RawData;142 // XmlDocument doc = new XmlDocument();143 // doc.LoadXml(rawData);144 // IItem algo = (IItem)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());145 // PluginManager.ControlManager.ShowControl(algo.CreateView());146 // }147 // }148 //}149 150 internal void FilterDataSet(Entity entity) {151 152 }153 154 #region IEnumerable<Record> Members155 156 public IEnumerator<Record> GetEnumerator() {157 throw new NotImplementedException();158 }159 160 #endregion161 162 #region IEnumerable Members163 164 IEnumerator IEnumerable.GetEnumerator() {165 return this.GetEnumerator();166 }167 168 #endregion169 119 } 170 120 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsViewContainer.Designer.cs
r1103 r1106 1 1 namespace HeuristicLab.CEDMA.Core { 2 partial class ResultsView {2 partial class ResultsViewContainer { 3 3 /// <summary> 4 4 /// Required designer variable. … … 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.yJitterLabel = new System.Windows.Forms.Label(); 27 this.xJitterlabel = new System.Windows.Forms.Label(); 28 this.xTrackBar = new System.Windows.Forms.TrackBar(); 29 this.xAxisLabel = new System.Windows.Forms.Label(); 30 this.xAxisComboBox = new System.Windows.Forms.ComboBox(); 31 this.yAxisLabel = new System.Windows.Forms.Label(); 32 this.yAxisComboBox = new System.Windows.Forms.ComboBox(); 33 this.yTrackBar = new System.Windows.Forms.TrackBar(); 34 this.sizeComboBox = new System.Windows.Forms.ComboBox(); 35 this.sizeLabel = new System.Windows.Forms.Label(); 36 this.invertCheckbox = new System.Windows.Forms.CheckBox(); 37 this.chartPanel = new System.Windows.Forms.Panel(); 38 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit(); 39 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit(); 26 this.viewComboBox = new System.Windows.Forms.ComboBox(); 27 this.showButton = new System.Windows.Forms.Button(); 28 this.viewPanel = new System.Windows.Forms.Panel(); 40 29 this.SuspendLayout(); 41 30 // 42 // yJitterLabel31 // viewComboBox 43 32 // 44 this. yJitterLabel.AutoSize= true;45 this. yJitterLabel.Location = new System.Drawing.Point(3, 30);46 this. yJitterLabel.Name = "yJitterLabel";47 this. yJitterLabel.Size = new System.Drawing.Size(29, 13);48 this. yJitterLabel.TabIndex = 13;49 this. yJitterLabel.Text = "jitter:";33 this.viewComboBox.FormattingEnabled = true; 34 this.viewComboBox.Location = new System.Drawing.Point(3, 3); 35 this.viewComboBox.Name = "viewComboBox"; 36 this.viewComboBox.Size = new System.Drawing.Size(121, 21); 37 this.viewComboBox.TabIndex = 1; 38 this.viewComboBox.SelectedValueChanged += new System.EventHandler(this.viewComboBox_SelectedValueChanged); 50 39 // 51 // xJitterlabel40 // showButton 52 41 // 53 this. xJitterlabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));54 this. xJitterlabel.AutoSize = true;55 this. xJitterlabel.Location = new System.Drawing.Point(291, 418);56 this. xJitterlabel.Name = "xJitterlabel";57 this. xJitterlabel.Size = new System.Drawing.Size(29, 13);58 this. xJitterlabel.TabIndex = 12;59 this. xJitterlabel.Text = "jitter:";42 this.showButton.Location = new System.Drawing.Point(130, 3); 43 this.showButton.Name = "showButton"; 44 this.showButton.Size = new System.Drawing.Size(75, 23); 45 this.showButton.TabIndex = 2; 46 this.showButton.Text = "Show"; 47 this.showButton.UseVisualStyleBackColor = true; 48 this.showButton.Click += new System.EventHandler(this.showButton_Click); 60 49 // 61 // xTrackBar50 // viewPanel 62 51 // 63 this.xTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 64 this.xTrackBar.Location = new System.Drawing.Point(326, 418); 65 this.xTrackBar.Maximum = 100; 66 this.xTrackBar.Name = "xTrackBar"; 67 this.xTrackBar.Size = new System.Drawing.Size(121, 45); 68 this.xTrackBar.TabIndex = 11; 69 this.xTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 70 this.xTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged); 71 // 72 // xAxisLabel 73 // 74 this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 75 this.xAxisLabel.AutoSize = true; 76 this.xAxisLabel.Location = new System.Drawing.Point(305, 394); 77 this.xAxisLabel.Name = "xAxisLabel"; 78 this.xAxisLabel.Size = new System.Drawing.Size(15, 13); 79 this.xAxisLabel.TabIndex = 8; 80 this.xAxisLabel.Text = "x:"; 81 // 82 // xAxisComboBox 83 // 84 this.xAxisComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 85 this.xAxisComboBox.FormattingEnabled = true; 86 this.xAxisComboBox.Location = new System.Drawing.Point(326, 391); 87 this.xAxisComboBox.Name = "xAxisComboBox"; 88 this.xAxisComboBox.Size = new System.Drawing.Size(121, 21); 89 this.xAxisComboBox.TabIndex = 7; 90 this.xAxisComboBox.SelectedIndexChanged += new System.EventHandler(this.xAxisComboBox_SelectedIndexChanged); 91 // 92 // yAxisLabel 93 // 94 this.yAxisLabel.AutoSize = true; 95 this.yAxisLabel.Location = new System.Drawing.Point(3, 6); 96 this.yAxisLabel.Name = "yAxisLabel"; 97 this.yAxisLabel.Size = new System.Drawing.Size(15, 13); 98 this.yAxisLabel.TabIndex = 6; 99 this.yAxisLabel.Text = "y:"; 100 // 101 // yAxisComboBox 102 // 103 this.yAxisComboBox.FormattingEnabled = true; 104 this.yAxisComboBox.Location = new System.Drawing.Point(24, 3); 105 this.yAxisComboBox.Name = "yAxisComboBox"; 106 this.yAxisComboBox.Size = new System.Drawing.Size(121, 21); 107 this.yAxisComboBox.TabIndex = 5; 108 this.yAxisComboBox.SelectedIndexChanged += new System.EventHandler(this.yAxisComboBox_SelectedIndexChanged); 109 // 110 // yTrackBar 111 // 112 this.yTrackBar.Location = new System.Drawing.Point(38, 30); 113 this.yTrackBar.Maximum = 100; 114 this.yTrackBar.Name = "yTrackBar"; 115 this.yTrackBar.Size = new System.Drawing.Size(107, 45); 116 this.yTrackBar.TabIndex = 10; 117 this.yTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 118 this.yTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged); 119 // 120 // sizeComboBox 121 // 122 this.sizeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 123 this.sizeComboBox.FormattingEnabled = true; 124 this.sizeComboBox.Location = new System.Drawing.Point(329, 3); 125 this.sizeComboBox.Name = "sizeComboBox"; 126 this.sizeComboBox.Size = new System.Drawing.Size(121, 21); 127 this.sizeComboBox.TabIndex = 14; 128 this.sizeComboBox.SelectedIndexChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged); 129 // 130 // sizeLabel 131 // 132 this.sizeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 133 this.sizeLabel.AutoSize = true; 134 this.sizeLabel.Location = new System.Drawing.Point(259, 6); 135 this.sizeLabel.Name = "sizeLabel"; 136 this.sizeLabel.Size = new System.Drawing.Size(64, 13); 137 this.sizeLabel.TabIndex = 15; 138 this.sizeLabel.Text = "Bubble size:"; 139 // 140 // invertCheckbox 141 // 142 this.invertCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 143 this.invertCheckbox.AutoSize = true; 144 this.invertCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; 145 this.invertCheckbox.Location = new System.Drawing.Point(326, 30); 146 this.invertCheckbox.Name = "invertCheckbox"; 147 this.invertCheckbox.Size = new System.Drawing.Size(64, 17); 148 this.invertCheckbox.TabIndex = 16; 149 this.invertCheckbox.Text = "Inverse:"; 150 this.invertCheckbox.UseVisualStyleBackColor = true; 151 this.invertCheckbox.CheckedChanged += new System.EventHandler(this.sizeComboBox_SelectedIndexChanged); 152 // 153 // chartPanel 154 // 155 this.chartPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 52 this.viewPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 156 53 | System.Windows.Forms.AnchorStyles.Left) 157 54 | System.Windows.Forms.AnchorStyles.Right))); 158 this. chartPanel.Location = new System.Drawing.Point(0, 81);159 this. chartPanel.Name = "chartPanel";160 this. chartPanel.Size = new System.Drawing.Size(447, 304);161 this. chartPanel.TabIndex = 17;55 this.viewPanel.Location = new System.Drawing.Point(4, 32); 56 this.viewPanel.Name = "viewPanel"; 57 this.viewPanel.Size = new System.Drawing.Size(443, 424); 58 this.viewPanel.TabIndex = 4; 162 59 // 163 // Result ListView60 // ResultsViewContainer 164 61 // 165 62 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 166 63 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 167 this.Controls.Add(this.chartPanel); 168 this.Controls.Add(this.invertCheckbox); 169 this.Controls.Add(this.sizeLabel); 170 this.Controls.Add(this.sizeComboBox); 171 this.Controls.Add(this.yJitterLabel); 172 this.Controls.Add(this.xJitterlabel); 173 this.Controls.Add(this.xTrackBar); 174 this.Controls.Add(this.xAxisLabel); 175 this.Controls.Add(this.xAxisComboBox); 176 this.Controls.Add(this.yAxisLabel); 177 this.Controls.Add(this.yAxisComboBox); 178 this.Controls.Add(this.yTrackBar); 179 this.Name = "ResultListView"; 64 this.Controls.Add(this.viewPanel); 65 this.Controls.Add(this.showButton); 66 this.Controls.Add(this.viewComboBox); 67 this.Name = "ResultsViewContainer"; 180 68 this.Size = new System.Drawing.Size(450, 459); 181 ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).EndInit();182 ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).EndInit();183 69 this.ResumeLayout(false); 184 this.PerformLayout();185 70 186 71 } … … 188 73 #endregion 189 74 190 private System.Windows.Forms.Label xAxisLabel; 191 private System.Windows.Forms.ComboBox xAxisComboBox; 192 private System.Windows.Forms.Label yAxisLabel; 193 private System.Windows.Forms.ComboBox yAxisComboBox; 194 private System.Windows.Forms.TrackBar yTrackBar; 195 private System.Windows.Forms.TrackBar xTrackBar; 196 private System.Windows.Forms.Label xJitterlabel; 197 private System.Windows.Forms.Label yJitterLabel; 198 private System.Windows.Forms.ComboBox sizeComboBox; 199 private System.Windows.Forms.Label sizeLabel; 200 private System.Windows.Forms.CheckBox invertCheckbox; 201 private System.Windows.Forms.Panel chartPanel; 75 private System.Windows.Forms.ComboBox viewComboBox; 76 private System.Windows.Forms.Button showButton; 77 private System.Windows.Forms.Panel viewPanel; 78 202 79 } 203 80 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsViewContainer.cs
r1103 r1106 8 8 using System.Windows.Forms; 9 9 using HeuristicLab.Core; 10 using HeuristicLab. CEDMA.Charting;10 using HeuristicLab.PluginInfrastructure; 11 11 12 12 namespace HeuristicLab.CEDMA.Core { 13 public partial class ResultsView : ViewBase {13 public partial class ResultsViewContainer : ViewBase { 14 14 private Results results; 15 private const string FREQUENCY = "<Frequency>";16 private const string CONSTANT_SIZE = "<constant>";17 private BubbleChartControl bubbleChartControl;18 private HistogramControl histogramControl;19 private Label pleaseSelectAxisLabel = new Label();20 15 21 public ResultsView (Results results) {16 public ResultsViewContainer(Results results) { 22 17 this.results = results; 23 18 InitializeComponent(); 24 InitCharts(); 25 xAxisComboBox.Items.AddRange(results.VariableNames); 26 yAxisComboBox.Items.Add(FREQUENCY); 27 yAxisComboBox.Items.AddRange(results.VariableNames); 28 sizeComboBox.Items.Add(CONSTANT_SIZE); 29 sizeComboBox.Items.AddRange(results.VariableNames); 30 sizeComboBox.SelectedItem = sizeComboBox.Items[0]; 31 sizeComboBox.Enabled = false; 32 invertCheckbox.Enabled = false; 33 sizeLabel.Enabled = false; 34 yAxisComboBox.SelectedItem = yAxisComboBox.Items[0]; 35 xAxisComboBox.SelectedItem = xAxisComboBox.Items[0]; 19 PopulateViewComboBox(); 20 showButton.Enabled = false; 36 21 } 37 22 38 private void InitCharts() {39 bubbleChartControl = new BubbleChartControl();40 bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);41 histogramControl = new HistogramControl();42 histogramControl.Chart = new Histogram(results, 0, 0, 100, 100);23 private void PopulateViewComboBox() { 24 DiscoveryService service = new DiscoveryService(); 25 Type[] viewTypes = service.GetTypes(typeof(IResultsView)); 26 foreach (Type t in viewTypes) 27 viewComboBox.Items.Add(t); 43 28 } 44 29 45 private void yAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) { 46 UpdateChart(); 47 } 48 49 private void xAxisComboBox_SelectedIndexChanged(object sender, EventArgs e) { 50 UpdateChart(); 51 } 52 53 private void UpdateChart() { 54 if(xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return; 55 if(yAxisComboBox.SelectedItem.Equals(FREQUENCY)) { 56 xJitterlabel.Enabled = false; 57 xTrackBar.Enabled = false; 58 yJitterLabel.Enabled = false; 59 yTrackBar.Enabled = false; 60 sizeComboBox.Enabled = false; 61 invertCheckbox.Enabled = false; 62 sizeLabel.Enabled = false; 63 chartPanel.Controls.Clear(); 64 chartPanel.Controls.Add(histogramControl); 65 histogramControl.Chart.ShowFrequency((string)xAxisComboBox.SelectedItem); 66 histogramControl.Dock = DockStyle.Fill; 67 } else { 68 xJitterlabel.Enabled = true; 69 xTrackBar.Enabled = true; 70 yJitterLabel.Enabled = true; 71 yTrackBar.Enabled = true; 72 sizeComboBox.Enabled = true; 73 invertCheckbox.Enabled = true; 74 sizeLabel.Enabled = true; 75 chartPanel.Controls.Clear(); 76 chartPanel.Controls.Add(bubbleChartControl); 77 bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem); 78 bubbleChartControl.Dock = DockStyle.Fill; 30 private void showButton_Click(object sender, EventArgs e) { 31 viewPanel.Controls.Clear(); 32 try { 33 Type type = (Type)viewComboBox.SelectedItem; 34 IResultsView view = (IResultsView)Activator.CreateInstance(type); 35 Control control = view.Control; 36 viewPanel.Controls.Add(control); 37 control.Dock = DockStyle.Fill; 38 view.ShowResults(results); 39 } 40 catch (Exception ex) { 41 Label errorLabel = new Label(); 42 errorLabel.Text = "Couldn't load selected view: " + viewComboBox.SelectedItem + "\n" + ex.Message; 43 viewPanel.Controls.Add(errorLabel); 44 errorLabel.Dock = DockStyle.Fill; 79 45 } 80 46 } 81 47 82 private void jitterTrackBar_ValueChanged(object sender, EventArgs e) { 83 if(bubbleChartControl.Chart != null) { 84 double xJitterFactor = xTrackBar.Value / 100.0; 85 double yJitterFactor = yTrackBar.Value / 100.0; 86 bubbleChartControl.Chart.SetJitter(xJitterFactor, yJitterFactor); 87 } 88 UpdateChart(); 89 } 90 91 private void sizeComboBox_SelectedIndexChanged(object sender, EventArgs e) { 92 if(bubbleChartControl.Chart != null) { 93 bubbleChartControl.Chart.SetBubbleSizeDimension((string)sizeComboBox.SelectedItem, invertCheckbox.Checked); 94 UpdateChart(); 95 } 48 private void viewComboBox_SelectedValueChanged(object sender, EventArgs e) { 49 showButton.Enabled = viewComboBox.SelectedItem != null; 96 50 } 97 51 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.sln
r1105 r1106 733 733 {1F5FA590-1D2D-406C-BDBD-03BAECEA3C80}.Visualization Debug|x86.Build.0 = Debug|x86 734 734 {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86 735 {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|Any CPU.Build.0 = Debug|x86736 735 {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|x86.ActiveCfg = Debug|x86 737 736 {1F1CF3ED-374C-4288-995B-93F6B872F571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU … … 747 746 {1F1CF3ED-374C-4288-995B-93F6B872F571}.Visualization Debug|x86.Build.0 = Debug|x86 748 747 {74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86 749 {74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|Any CPU.Build.0 = Debug|x86750 748 {74223A32-C726-4978-BE78-37113A18373C}.CEDMA Debug|x86.ActiveCfg = Debug|x86 751 749 {74223A32-C726-4978-BE78-37113A18373C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU … … 761 759 {74223A32-C726-4978-BE78-37113A18373C}.Visualization Debug|x86.Build.0 = Debug|x86 762 760 {7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86 763 {7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|Any CPU.Build.0 = Debug|x86764 761 {7C20D100-8BEB-433A-9499-F075E2CB9297}.CEDMA Debug|x86.ActiveCfg = Debug|x86 765 762 {7C20D100-8BEB-433A-9499-F075E2CB9297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU … … 775 772 {7C20D100-8BEB-433A-9499-F075E2CB9297}.Visualization Debug|x86.Build.0 = Debug|x86 776 773 {6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|Any CPU.ActiveCfg = Debug|x86 777 {6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|Any CPU.Build.0 = Debug|x86778 774 {6084CFB5-733F-449D-9F92-2E40D13F0514}.CEDMA Debug|x86.ActiveCfg = Debug|x86 779 775 {6084CFB5-733F-449D-9F92-2E40D13F0514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Note: See TracChangeset
for help on using the changeset viewer.