Changeset 6115 for branches/histogram
- Timestamp:
- 05/03/11 19:52:35 (13 years ago)
- Location:
- branches/histogram
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs
r5445 r6115 27 27 [View("DataTableHistory View")] 28 28 [Content(typeof(DataTableHistory), true)] 29 public partial class DataTableHistoryView : MovieView<DataTable> {29 public partial class DataTableHistoryView : MovieView<DataTable>, IConfigureableView { 30 30 public DataTableHistoryView() { 31 31 InitializeComponent(); 32 32 itemsGroupBox.Text = "Data Table"; 33 33 } 34 35 public void ShowConfiguration() { 36 DataTable current = viewHost.Content as DataTable; 37 if (current == null) return; 38 using (DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(current)) { 39 if (dialog.ShowDialog() != DialogResult.OK) return; 40 foreach (DataTable dt in Content) { 41 if (current != dt) { 42 dt.VisualProperties = (DataTableVisualProperties)current.VisualProperties.Clone(); 43 foreach (DataRow row in current.Rows) 44 dt.Rows[row.Name].VisualProperties = (DataRowVisualProperties)row.VisualProperties.Clone(); 45 } 46 } 47 } 48 } 49 34 50 } 35 51 } -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.cs
r6032 r6115 236 236 } 237 237 area.RecalculateAxesScale(); 238 area.AxisX.IsMarginVisible = false; 239 area.AxisX2.IsMarginVisible = false; 238 240 239 241 if (!Content.VisualProperties.XAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.XAxisMinimumFixedValue)) area.AxisX.Minimum = Content.VisualProperties.XAxisMinimumFixedValue; 240 #region Workaround for bug in RecalculateAxesScale() that would assign -1241 else {242 if (area.AxisX.IsStartedFromZero243 && chart.Series.Where(x => x.XAxisType == AxisType.Primary).Any()244 && chart.Series.Where(x => x.XAxisType == AxisType.Primary).SelectMany(x => x.Points).Any()) {245 double minX = chart.Series.Where(x => x.XAxisType == AxisType.Primary).SelectMany(x => x.Points).Select(x => x.XValue).Min();246 if (minX >= 0 && area.AxisX.Minimum < 0) area.AxisX.Minimum = 0;247 }248 }249 #endregion250 242 if (!Content.VisualProperties.XAxisMaximumAuto && !double.IsNaN(Content.VisualProperties.XAxisMaximumFixedValue)) area.AxisX.Maximum = Content.VisualProperties.XAxisMaximumFixedValue; 251 243 if (!Content.VisualProperties.SecondXAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.SecondXAxisMinimumFixedValue)) area.AxisX2.Minimum = Content.VisualProperties.SecondXAxisMinimumFixedValue; 252 #region Workaround for bug in RecalculateAxesScale() that would assign -1253 else {254 if (area.AxisX2.IsStartedFromZero255 && chart.Series.Where(x => x.XAxisType == AxisType.Secondary).Any()256 && chart.Series.Where(x => x.XAxisType == AxisType.Secondary).SelectMany(x => x.Points).Any()) {257 double minX2 = chart.Series.Where(x => x.XAxisType == AxisType.Secondary).SelectMany(x => x.Points).Select(x => x.XValue).Min();258 if (minX2 >= 0 && area.AxisX2.Minimum < 0) area.AxisX2.Minimum = 0;259 }260 }261 #endregion262 244 if (!Content.VisualProperties.SecondXAxisMaximumAuto && !double.IsNaN(Content.VisualProperties.SecondXAxisMaximumFixedValue)) area.AxisX2.Maximum = Content.VisualProperties.SecondXAxisMaximumFixedValue; 263 245 if (!Content.VisualProperties.YAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.YAxisMinimumFixedValue)) area.AxisY.Minimum = Content.VisualProperties.YAxisMinimumFixedValue; … … 575 557 double maxValue = row.Values.Max(); 576 558 double intervalWidth = (maxValue - minValue) / bins; 577 if (intervalWidth <= 0) return; 559 if (intervalWidth < 0) return; 560 if (intervalWidth == 0) { 561 series.Points.AddXY(minValue, row.Values.Count); 562 return; 563 } 578 564 579 565 if (!row.VisualProperties.ExactBins) { … … 585 571 double current = minValue, intervalCenter = intervalWidth / 2.0; 586 572 int frequency = 0; 573 series.Points.AddXY(current - intervalCenter, 0); // so that the first column is not visually truncated 587 574 foreach (double v in row.Values.Where(x => !IsInvalidValue(x)).OrderBy(x => x)) { 588 575 while (v > current + intervalWidth) { … … 594 581 } 595 582 series.Points.AddXY(current + intervalCenter, frequency); 583 series.Points.AddXY(current + 3 * intervalCenter, 0); // so that the last column is not visually truncated 596 584 } 597 585 -
branches/histogram/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs
r6013 r6115 97 97 } else { 98 98 qualityDistribution = new DataTable("Population Quality Distribution", description); 99 qualityDistribution.VisualProperties.XAxisTitle = IterationsParameter.ActualName;100 qualityDistribution.VisualProperties.YAxisTitle = QualityParameter.ActualName;99 qualityDistribution.VisualProperties.XAxisTitle = QualityParameter.ActualName; 100 qualityDistribution.VisualProperties.YAxisTitle = "Frequency"; 101 101 results.Add(new Result(HistogramName, description, qualityDistribution)); 102 102 } … … 108 108 } 109 109 var qualities = QualityParameter.ActualValue; 110 row.Values.Clear(); 111 row.Values.AddRange(qualities.Select(x => x.Value)); 110 row.Values.Replace(qualities.Select(x => x.Value)); 112 111 113 112 if (StoreHistory) { -
branches/histogram/HeuristicLab.Collections/3.3/ObservableList.cs
r5445 r6115 24 24 using System.Collections.Generic; 25 25 using System.ComponentModel; 26 using System.Linq; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 28 … … 211 212 } 212 213 214 /// <summary> 215 /// Performs a Clear and an AddRange, but does not fire separate events for those operations 216 /// </summary> 217 /// <param name="collection"></param> 218 public void Replace(IEnumerable<T> collection) { 219 List<IndexedItem<T>> oldItems = null; 220 if (list.Any()) oldItems = list.Select((x, i) => new IndexedItem<T>(i, x)).ToList(); 221 else oldItems = new List<IndexedItem<T>>(); 222 223 int oldCapacity = list.Capacity; 224 list.Clear(); 225 list.AddRange(collection); 226 227 List<IndexedItem<T>> items = null; 228 if (list.Any()) items = list.Select((x, i) => new IndexedItem<T>(i, x)).ToList(); 229 else items = new List<IndexedItem<T>>(); 230 231 if (oldCapacity != list.Capacity) OnPropertyChanged("Capacity"); 232 OnPropertyChanged("Item[]"); 233 if (oldItems.Count != items.Count) OnPropertyChanged("Count"); 234 OnItemsReplaced(items, oldItems); 235 } 236 213 237 public bool Remove(T item) { 214 238 int index = list.IndexOf(item); -
branches/histogram/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.Designer.cs
r5956 r6115 51 51 this.viewContextMenuStrip = new HeuristicLab.MainForm.WindowsForms.ViewContextMenuStrip(); 52 52 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 53 this.configurationLabel = new System.Windows.Forms.Label(); 53 54 this.SuspendLayout(); 54 55 // … … 86 87 this.viewContextMenuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.viewContextMenuStrip_ItemClicked); 87 88 // 89 // configurationLabel 90 // 91 this.configurationLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 92 this.configurationLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.EditInformation; 93 this.configurationLabel.Location = new System.Drawing.Point(211, 22); 94 this.configurationLabel.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); 95 this.configurationLabel.Name = "configurationLabel"; 96 this.configurationLabel.Size = new System.Drawing.Size(16, 16); 97 this.configurationLabel.TabIndex = 0; 98 this.configurationLabel.Visible = false; 99 this.configurationLabel.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.configurationLabel_MouseDoubleClick); 100 // 88 101 // ViewHost 89 102 // … … 91 104 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 92 105 this.Controls.Add(this.viewsLabel); 106 this.Controls.Add(this.configurationLabel); 93 107 this.Controls.Add(this.messageLabel); 94 108 this.Name = "ViewHost"; … … 103 117 private System.Windows.Forms.ToolTip toolTip; 104 118 private HeuristicLab.MainForm.WindowsForms.ViewContextMenuStrip viewContextMenuStrip; 119 private System.Windows.Forms.Label configurationLabel; 105 120 106 121 } -
branches/histogram/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs
r5956 r6115 101 101 } 102 102 } else viewType = null; 103 configurationLabel.Visible = activeView is IConfigureableView; 104 configurationLabel.Enabled = activeView != null && !activeView.Locked; 103 105 } 104 106 } … … 189 191 private void activeView_LockedChanged(object sender, EventArgs e) { 190 192 Locked = activeView.Locked; 193 configurationLabel.Enabled = !activeView.Locked; 191 194 } 192 195 … … 200 203 base.OnSizeChanged(e); 201 204 viewsLabel.Location = new Point(Width - viewsLabel.Margin.Right - viewsLabel.Width, viewsLabel.Margin.Top); 205 configurationLabel.Location = new Point(Width - configurationLabel.Margin.Right - configurationLabel.Width, viewsLabel.Bottom + viewsLabel.Margin.Bottom + configurationLabel.Margin.Top); 202 206 } 203 207 … … 287 291 startDragAndDrop = false; 288 292 } 293 294 private void configurationLabel_MouseDoubleClick(object sender, MouseEventArgs e) { 295 ((IConfigureableView)ActiveView).ShowConfiguration(); 296 } 289 297 #endregion 290 298 } -
branches/histogram/HeuristicLab.MainForm/3.3/HeuristicLab.MainForm-3.3.csproj
r5163 r6115 12 12 <AssemblyName>HeuristicLab.MainForm-3.3</AssemblyName> 13 13 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 <TargetFrameworkProfile></TargetFrameworkProfile> 14 <TargetFrameworkProfile> 15 </TargetFrameworkProfile> 15 16 <FileAlignment>512</FileAlignment> 16 17 <SignAssembly>true</SignAssembly> … … 111 112 <ItemGroup> 112 113 <None Include="HeuristicLabMainFormPlugin.cs.frame" /> 114 <Compile Include="Interfaces\IConfigureableView.cs" /> 113 115 <Compile Include="ViewAttribute.cs" /> 114 116 <Compile Include="Interfaces\IContentView.cs" /> -
branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r6089 r6115 164 164 Parameters.Add(new OptionalValueParameter<ItemList<Permutation>>("BestKnownSolutions", "The list of best known solutions which is updated whenever a new better solution is found or may be the optimal solution if it is known beforehand.", null)); 165 165 } 166 if (Parameters.ContainsKey("DistanceMatrix")) { 167 DoubleMatrix bla = ((ValueParameter<DoubleMatrix>)Parameters["DistanceMatrix"]).Value; 168 Parameters.Remove("DistanceMatrix"); 169 Parameters.Add(new ValueParameter<DoubleMatrix>("Distances", "bla", bla)); 170 } 171 AttachEventHandlers(); 166 172 #endregion 167 173 } … … 252 258 253 259 #region Helpers 254 [StorableHook(HookType.AfterDeserialization)]255 private void AfterDeserializationHook() {256 AttachEventHandlers();257 }258 259 260 private void AttachEventHandlers() { 260 261 SolutionCreator.PermutationParameter.ActualNameChanged += new EventHandler(SolutionCreator_PermutationParameter_ActualNameChanged);
Note: See TracChangeset
for help on using the changeset viewer.