Changeset 6010 for branches/histogram
- Timestamp:
- 04/14/11 00:18:46 (14 years ago)
- Location:
- branches/histogram
- Files:
-
- 8 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs
r5832 r6010 89 89 series1.Name = "Default"; 90 90 this.chart.Series.Add(series1); 91 this.chart.ShowPropertiesContextMenuItem = true; 91 92 this.chart.Size = new System.Drawing.Size(359, 248); 92 93 this.chart.TabIndex = 3; … … 96 97 title1.Text = "Title"; 97 98 this.chart.Titles.Add(title1); 99 this.chart.PropertiesClicked += new System.EventHandler(this.chart_PropertiesClicked); 98 100 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 99 101 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.cs
r5445 r6010 133 133 series.ChartType = SeriesChartType.FastPoint; 134 134 break; 135 case DataRowVisualProperties.DataRowChartType.Histogram: 136 series.ChartType = SeriesChartType.Column; 137 series["PointWidth"] = "1"; 138 break; 135 139 default: 136 140 series.ChartType = SeriesChartType.FastPoint; … … 283 287 else { 284 288 DataRow row = (DataRow)sender; 289 if (chart.Series[row.Name].IsCustomPropertySet("PointWidth")) 290 chart.Series[row.Name].DeleteCustomProperty("PointWidth"); 285 291 switch (row.VisualProperties.ChartType) { 286 292 case DataRowVisualProperties.DataRowChartType.Line: … … 296 302 chart.Series[row.Name].ChartType = SeriesChartType.FastPoint; 297 303 break; 304 case DataRowVisualProperties.DataRowChartType.Histogram: 305 chart.Series[row.Name].ChartType = SeriesChartType.Column; 306 chart.Series[row.Name]["PointWidth"] = "1"; 307 break; 298 308 default: 299 309 chart.Series[row.Name].ChartType = SeriesChartType.FastPoint; … … 354 364 Series rowSeries = chart.Series[row.Name]; 355 365 if (!invisibleSeries.Contains(rowSeries)) { 356 foreach (IndexedItem<double> item in e.Items) { 357 if (IsInvalidValue(item.Value)) 358 rowSeries.Points[item.Index].IsEmpty = true; 359 else { 360 rowSeries.Points[item.Index].YValues = new double[] { item.Value }; 361 rowSeries.Points[item.Index].IsEmpty = false; 366 if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) { 367 rowSeries.Points.Clear(); 368 FillSeriesWithRowValues(rowSeries, row); 369 } else { 370 foreach (IndexedItem<double> item in e.Items) { 371 if (IsInvalidValue(item.Value)) 372 rowSeries.Points[item.Index].IsEmpty = true; 373 else { 374 rowSeries.Points[item.Index].YValues = new double[] { item.Value }; 375 rowSeries.Points[item.Index].IsEmpty = false; 376 } 362 377 } 363 378 } … … 429 444 430 445 private void FillSeriesWithRowValues(Series series, DataRow row) { 431 for (int i = 0; i < row.Values.Count; i++) { 432 var value = row.Values[i]; 433 DataPoint point = new DataPoint(); 434 point.XValue = row.VisualProperties.StartIndexZero ? i : i + 1; 435 if (IsInvalidValue(value)) 436 point.IsEmpty = true; 437 else 438 point.YValues = new double[] { value }; 439 series.Points.Add(point); 440 } 446 if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) { 447 series.Points.Clear(); 448 if (!row.Values.Any()) return; 449 int bins = row.VisualProperties.Bins; 450 451 double minValue = row.Values.Min(); 452 double maxValue = row.Values.Max(); 453 double intervalWidth = (maxValue - minValue) / bins; 454 if (intervalWidth <= 0) return; 455 456 if (!row.VisualProperties.ExactBins) { 457 intervalWidth = HumanRoundRange(intervalWidth); 458 minValue = Math.Floor(minValue / intervalWidth) * intervalWidth; 459 maxValue = Math.Ceiling(maxValue / intervalWidth) * intervalWidth; 460 } 461 462 double current = minValue, intervalCenter = intervalWidth / 2.0; 463 int frequency = 0; 464 foreach (double v in row.Values.Where(x => !IsInvalidValue(x)).OrderBy(x => x)) { 465 while (v > current + intervalWidth) { 466 series.Points.AddXY(current + intervalCenter, frequency); 467 current += intervalWidth; 468 frequency = 0; 469 } 470 frequency++; 471 } 472 series.Points.AddXY(current + intervalCenter, frequency); 473 } else { 474 for (int i = 0; i < row.Values.Count; i++) { 475 var value = row.Values[i]; 476 DataPoint point = new DataPoint(); 477 point.XValue = row.VisualProperties.StartIndexZero ? i : i + 1; 478 if (IsInvalidValue(value)) 479 point.IsEmpty = true; 480 else 481 point.YValues = new double[] { value }; 482 series.Points.Add(point); 483 } 484 } 485 } 486 487 private double HumanRoundRange(double range) { 488 double base10 = Math.Pow(10.0, Math.Floor(Math.Log10(range))); 489 double rounding = range / base10; 490 if (rounding <= 1.5) rounding = 1; 491 else if (rounding <= 2.25) rounding = 2; 492 else if (rounding <= 3.75) rounding = 2.5; 493 else if (rounding <= 7.5) rounding = 5; 494 else rounding = 10; 495 return rounding * base10; 441 496 } 442 497 … … 459 514 } 460 515 } 516 517 private void chart_PropertiesClicked(object sender, EventArgs e) { 518 DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(Content); 519 dialog.ShowDialog(); 520 } 461 521 #endregion 462 522 -
branches/histogram/HeuristicLab.Analysis.Views/3.3/HeuristicLab.Analysis.Views-3.3.csproj
r5994 r6010 130 130 <DependentUpon>AggregatedHistogramHistoryView.cs</DependentUpon> 131 131 </Compile> 132 <Compile Include="DataRowVisualPropertiesControl.cs"> 133 <SubType>UserControl</SubType> 134 </Compile> 135 <Compile Include="DataRowVisualPropertiesControl.Designer.cs"> 136 <DependentUpon>DataRowVisualPropertiesControl.cs</DependentUpon> 137 </Compile> 138 <Compile Include="DataTableVisualPropertiesDialog.cs"> 139 <SubType>Form</SubType> 140 </Compile> 141 <Compile Include="DataTableVisualPropertiesDialog.Designer.cs"> 142 <DependentUpon>DataTableVisualPropertiesDialog.cs</DependentUpon> 143 </Compile> 132 144 <Compile Include="HistogramHistoryView.cs"> 133 145 <SubType>UserControl</SubType> … … 193 205 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 194 206 <Name>HeuristicLab.Collections-3.3</Name> 207 </ProjectReference> 208 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 209 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 210 <Name>HeuristicLab.Common.Resources-3.3</Name> 195 211 </ProjectReference> 196 212 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> … … 251 267 <EmbeddedResource Include="AggregatedHistogramHistoryView.resx"> 252 268 <DependentUpon>AggregatedHistogramHistoryView.cs</DependentUpon> 269 </EmbeddedResource> 270 <EmbeddedResource Include="DataRowVisualPropertiesControl.resx"> 271 <DependentUpon>DataRowVisualPropertiesControl.cs</DependentUpon> 272 </EmbeddedResource> 273 <EmbeddedResource Include="DataTableView.resx"> 274 <DependentUpon>DataTableView.cs</DependentUpon> 275 </EmbeddedResource> 276 <EmbeddedResource Include="DataTableVisualPropertiesDialog.resx"> 277 <DependentUpon>DataTableVisualPropertiesDialog.cs</DependentUpon> 253 278 </EmbeddedResource> 254 279 <EmbeddedResource Include="HeatMapView.resx"> -
branches/histogram/HeuristicLab.Analysis.Views/3.3/HeuristicLabAnalysisViewsPlugin.cs.frame
r5446 r6010 31 31 [PluginDependency("HeuristicLab.Collections", "3.3")] 32 32 [PluginDependency("HeuristicLab.Common", "3.3")] 33 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 33 34 [PluginDependency("HeuristicLab.Core", "3.3")] 34 35 [PluginDependency("HeuristicLab.Core.Views", "3.3")] -
branches/histogram/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs
r5445 r6010 36 36 Columns, 37 37 Points, 38 Bars 38 Bars, 39 Histogram 39 40 } 40 41 #endregion … … 80 81 } 81 82 } 83 private int bins; 84 public int Bins { 85 get { return bins; } 86 set { 87 if (bins != value) { 88 bins = value; 89 OnPropertyChanged("Bins"); 90 } 91 } 92 } 93 private bool exactBins; 94 public bool ExactBins { 95 get { return exactBins; } 96 set { 97 if (exactBins != value) { 98 exactBins = value; 99 OnPropertyChanged("ExactBins"); 100 } 101 } 102 } 82 103 83 104 #region Persistence Properties … … 101 122 get { return startIndexZero; } 102 123 set { startIndexZero = value; } 124 } 125 [Storable(Name = "Bins")] 126 private int StorableBins { 127 get { return bins; } 128 set { bins = value; } 129 } 130 [Storable(Name = "ExactBins")] 131 private bool StorableExactBins { 132 get { return exactBins; } 133 set { exactBins = value; } 103 134 } 104 135 #endregion -
branches/histogram/HeuristicLab.Problems.QuadraticAssignment/3.3/Analyzers/QAPAlleleFrequencyAnalyzer.cs
r5996 r6010 68 68 for (int j = 0; j < solution.Length; j++) 69 69 impact += weights[source, j] * distances[target, solution[j]]; 70 alleles[i] = new Allele(source.ToString() + "- " + target.ToString(), impact);70 alleles[i] = new Allele(source.ToString() + "->" + target.ToString(), impact); 71 71 } 72 72 -
branches/histogram/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.Designer.cs
r5445 r6010 50 50 this.copyImageToClipboardBitmapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 51 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 52 this.propertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 this.propertiesToolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 52 54 this.contextMenuStrip.SuspendLayout(); 53 55 ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); … … 58 60 this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 59 61 this.exportChartToolStripMenuItem, 60 this.copyImageToClipboardBitmapToolStripMenuItem}); 62 this.copyImageToClipboardBitmapToolStripMenuItem, 63 this.propertiesToolStripSeparator, 64 this.propertiesToolStripMenuItem}); 61 65 this.contextMenuStrip.Name = "contextMenuStrip"; 62 this.contextMenuStrip.Size = new System.Drawing.Size(257, 48); 66 this.contextMenuStrip.Size = new System.Drawing.Size(257, 76); 67 this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); 63 68 // 64 69 // exportChartToolStripMenuItem … … 78 83 // saveFileDialog 79 84 // 80 this.saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|JPEG (*.jpg)|*.jpg|EMF (*.emf)|*.emf|PNG (*.png)|*.png|GIF " +81 " (*.gif)|*.gif|TIFF (*.tif)|*.tif\"";85 this.saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|JPEG (*.jpg)|*.jpg|EMF (*.emf)|*.emf|PNG (*.png)|*.png|GIF (" + 86 "*.gif)|*.gif|TIFF (*.tif)|*.tif\""; 82 87 this.saveFileDialog.FilterIndex = 2; 88 // 89 // propertiesToolStripMenuItem 90 // 91 this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; 92 this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(256, 22); 93 this.propertiesToolStripMenuItem.Text = "Properties"; 94 this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesToolStripMenuItem_Click); 95 // 96 // propertiesToolStripSeparator 97 // 98 this.propertiesToolStripSeparator.Name = "propertiesToolStripSeparator"; 99 this.propertiesToolStripSeparator.Size = new System.Drawing.Size(253, 6); 83 100 // 84 101 // EnhancedChart … … 97 114 private System.Windows.Forms.ToolStripMenuItem copyImageToClipboardBitmapToolStripMenuItem; 98 115 private System.Windows.Forms.SaveFileDialog saveFileDialog; 116 private System.Windows.Forms.ToolStripSeparator propertiesToolStripSeparator; 117 private System.Windows.Forms.ToolStripMenuItem propertiesToolStripMenuItem; 99 118 } 100 119 } -
branches/histogram/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.cs
r5445 r6010 40 40 [DefaultValue(true)] 41 41 public bool EnableMiddleClickPanning { get; set; } 42 [DefaultValue(false)] 43 public bool ShowPropertiesContextMenuItem { get; set; } 42 44 43 45 public static void CustomizeChartArea(ChartArea chartArea) { … … 138 140 #endregion 139 141 142 private void contextMenuStrip_Opening(object sender, CancelEventArgs e) { 143 propertiesToolStripSeparator.Visible = ShowPropertiesContextMenuItem; 144 propertiesToolStripMenuItem.Visible = ShowPropertiesContextMenuItem; 145 } 146 140 147 private void exportChartToolStripMenuItem_Click(object sender, System.EventArgs e) { 141 148 // Set image file format … … 168 175 Clipboard.SetDataObject(bmp); 169 176 } 177 178 private void propertiesToolStripMenuItem_Click(object sender, EventArgs e) { 179 OnPropertiesClicked(); 180 } 181 182 public event EventHandler PropertiesClicked; 183 private void OnPropertiesClicked() { 184 var handler = PropertiesClicked; 185 if (handler != null) handler(this, EventArgs.Empty); 186 } 170 187 } 171 188 } -
branches/histogram/HeuristicLab.Visualization.ChartControlsExtensions/3.3/HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj
r5970 r6010 141 141 </ProjectReference> 142 142 </ItemGroup> 143 <ItemGroup> 144 <EmbeddedResource Include="EnhancedChart.resx"> 145 <DependentUpon>EnhancedChart.cs</DependentUpon> 146 </EmbeddedResource> 147 </ItemGroup> 143 148 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 144 149 <PropertyGroup>
Note: See TracChangeset
for help on using the changeset viewer.