Changeset 6020
- Timestamp:
- 04/18/11 17:33:13 (14 years ago)
- Location:
- branches/histogram
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableView.cs
r6016 r6020 164 164 series.BorderWidth = 1; 165 165 series.BorderDashStyle = ChartDashStyle.Solid; 166 series.BorderColor = Color.Empty; 167 168 if (row.VisualProperties.Color != Color.Empty) 169 series.Color = row.VisualProperties.Color; 170 else series.Color = Color.Empty; 166 171 167 172 switch (row.VisualProperties.ChartType) { … … 172 177 break; 173 178 case DataRowVisualProperties.DataRowChartType.Bars: 179 // Bar is incompatible with anything but Bar and StackedBar* 174 180 if (!chart.Series.Any(x => x.ChartType != SeriesChartType.Bar && x.ChartType != SeriesChartType.StackedBar && x.ChartType != SeriesChartType.StackedBar100)) 175 181 series.ChartType = SeriesChartType.Bar; … … 188 194 series.ChartType = SeriesChartType.Column; 189 195 series.SetCustomProperty("PointWidth", "1"); 196 if (!series.Color.IsEmpty && series.Color.GetBrightness() < 0.25) 197 series.BorderColor = Color.White; 198 else series.BorderColor = Color.Black; 190 199 break; 191 200 default: … … 195 204 series.YAxisType = row.VisualProperties.SecondYAxis ? AxisType.Secondary : AxisType.Primary; 196 205 series.XAxisType = row.VisualProperties.SecondXAxis ? AxisType.Secondary : AxisType.Primary; 197 if (row.VisualProperties.Color != Color.Empty)198 series.Color = row.VisualProperties.Color;199 else series.Color = Color.Empty;200 206 series.ToolTip = row.Name + " X = #INDEX, Y = #VAL"; 201 207 } 202 208 203 209 private void ConfigureChartArea(ChartArea area) { 210 if (Content.VisualProperties.TitleFont != null) 211 chart.Titles[0].Font = Content.VisualProperties.TitleFont; 212 if (!Content.VisualProperties.TitleColor.IsEmpty) 213 chart.Titles[0].ForeColor = Content.VisualProperties.TitleColor; 214 215 if (Content.VisualProperties.AxisTitleFont != null) 216 area.AxisX.TitleFont = Content.VisualProperties.AxisTitleFont; 217 if (!Content.VisualProperties.AxisTitleColor.IsEmpty) 218 area.AxisX.TitleForeColor = Content.VisualProperties.AxisTitleColor; 204 219 area.AxisX.Title = Content.VisualProperties.XAxisTitle; 220 221 if (Content.VisualProperties.AxisTitleFont != null) 222 area.AxisX2.TitleFont = Content.VisualProperties.AxisTitleFont; 223 if (!Content.VisualProperties.AxisTitleColor.IsEmpty) 224 area.AxisX2.TitleForeColor = Content.VisualProperties.AxisTitleColor; 205 225 area.AxisX2.Title = Content.VisualProperties.SecondXAxisTitle; 226 227 if (Content.VisualProperties.AxisTitleFont != null) 228 area.AxisY.TitleFont = Content.VisualProperties.AxisTitleFont; 229 if (!Content.VisualProperties.AxisTitleColor.IsEmpty) 230 area.AxisY.TitleForeColor = Content.VisualProperties.AxisTitleColor; 206 231 area.AxisY.Title = Content.VisualProperties.YAxisTitle; 232 233 if (Content.VisualProperties.AxisTitleFont != null) 234 area.AxisY2.TitleFont = Content.VisualProperties.AxisTitleFont; 235 if (!Content.VisualProperties.AxisTitleColor.IsEmpty) 236 area.AxisY2.TitleForeColor = Content.VisualProperties.AxisTitleColor; 207 237 area.AxisY2.Title = Content.VisualProperties.SecondYAxisTitle; 238 208 239 area.RecalculateAxesScale(); 209 240 area.AxisX.Minimum = Content.VisualProperties.XAxisMinimumFixedValue; -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.Designer.cs
r6014 r6020 77 77 this.xAxisSecondaryMinimumAutoRadioButton = new System.Windows.Forms.RadioButton(); 78 78 this.axisTabControl = new System.Windows.Forms.TabControl(); 79 this.mainTabPage = new System.Windows.Forms.TabPage(); 80 this.axisFontLabel = new System.Windows.Forms.Label(); 81 this.titleFontLabel = new System.Windows.Forms.Label(); 82 this.axisFontButton = new System.Windows.Forms.Button(); 83 this.label3 = new System.Windows.Forms.Label(); 84 this.titleFontButton = new System.Windows.Forms.Button(); 85 this.label2 = new System.Windows.Forms.Label(); 79 86 this.xAxisTabPage = new System.Windows.Forms.TabPage(); 80 87 this.yAxisTabPage = new System.Windows.Forms.TabPage(); … … 102 109 this.yAxisPrimaryMinimumAutoRadioButton = new System.Windows.Forms.RadioButton(); 103 110 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 111 this.titleFontDialog = new System.Windows.Forms.FontDialog(); 112 this.axisFontDialog = new System.Windows.Forms.FontDialog(); 104 113 this.xAxisPrimaryGroupBox.SuspendLayout(); 105 114 this.xAxisPrimaryMaximumPanel.SuspendLayout(); … … 109 118 this.xAxisSecondaryMinimumPanel.SuspendLayout(); 110 119 this.axisTabControl.SuspendLayout(); 120 this.mainTabPage.SuspendLayout(); 111 121 this.xAxisTabPage.SuspendLayout(); 112 122 this.yAxisTabPage.SuspendLayout(); … … 435 445 | System.Windows.Forms.AnchorStyles.Left) 436 446 | System.Windows.Forms.AnchorStyles.Right))); 447 this.axisTabControl.Controls.Add(this.mainTabPage); 437 448 this.axisTabControl.Controls.Add(this.xAxisTabPage); 438 449 this.axisTabControl.Controls.Add(this.yAxisTabPage); … … 442 453 this.axisTabControl.Size = new System.Drawing.Size(336, 257); 443 454 this.axisTabControl.TabIndex = 0; 455 // 456 // mainTabPage 457 // 458 this.mainTabPage.Controls.Add(this.axisFontLabel); 459 this.mainTabPage.Controls.Add(this.titleFontLabel); 460 this.mainTabPage.Controls.Add(this.axisFontButton); 461 this.mainTabPage.Controls.Add(this.label3); 462 this.mainTabPage.Controls.Add(this.titleFontButton); 463 this.mainTabPage.Controls.Add(this.label2); 464 this.mainTabPage.Location = new System.Drawing.Point(4, 22); 465 this.mainTabPage.Name = "mainTabPage"; 466 this.mainTabPage.Size = new System.Drawing.Size(328, 231); 467 this.mainTabPage.TabIndex = 2; 468 this.mainTabPage.Text = "Main"; 469 this.mainTabPage.UseVisualStyleBackColor = true; 470 // 471 // axisFontLabel 472 // 473 this.axisFontLabel.AutoSize = true; 474 this.axisFontLabel.Location = new System.Drawing.Point(101, 44); 475 this.axisFontLabel.Name = "axisFontLabel"; 476 this.axisFontLabel.Size = new System.Drawing.Size(13, 13); 477 this.axisFontLabel.TabIndex = 2; 478 this.axisFontLabel.Text = "()"; 479 // 480 // titleFontLabel 481 // 482 this.titleFontLabel.AutoSize = true; 483 this.titleFontLabel.Location = new System.Drawing.Point(101, 15); 484 this.titleFontLabel.Name = "titleFontLabel"; 485 this.titleFontLabel.Size = new System.Drawing.Size(13, 13); 486 this.titleFontLabel.TabIndex = 2; 487 this.titleFontLabel.Text = "()"; 488 // 489 // axisFontButton 490 // 491 this.axisFontButton.Location = new System.Drawing.Point(69, 39); 492 this.axisFontButton.Name = "axisFontButton"; 493 this.axisFontButton.Size = new System.Drawing.Size(26, 23); 494 this.axisFontButton.TabIndex = 1; 495 this.axisFontButton.Text = "..."; 496 this.axisFontButton.UseVisualStyleBackColor = true; 497 this.axisFontButton.Click += new System.EventHandler(this.axisFontButton_Click); 498 // 499 // label3 500 // 501 this.label3.AutoSize = true; 502 this.label3.Location = new System.Drawing.Point(9, 44); 503 this.label3.Name = "label3"; 504 this.label3.Size = new System.Drawing.Size(53, 13); 505 this.label3.TabIndex = 0; 506 this.label3.Text = "Axis Font:"; 507 // 508 // titleFontButton 509 // 510 this.titleFontButton.Location = new System.Drawing.Point(69, 10); 511 this.titleFontButton.Name = "titleFontButton"; 512 this.titleFontButton.Size = new System.Drawing.Size(26, 23); 513 this.titleFontButton.TabIndex = 1; 514 this.titleFontButton.Text = "..."; 515 this.titleFontButton.UseVisualStyleBackColor = true; 516 this.titleFontButton.Click += new System.EventHandler(this.titleFontButton_Click); 517 // 518 // label2 519 // 520 this.label2.AutoSize = true; 521 this.label2.Location = new System.Drawing.Point(9, 15); 522 this.label2.Name = "label2"; 523 this.label2.Size = new System.Drawing.Size(54, 13); 524 this.label2.TabIndex = 0; 525 this.label2.Text = "Title Font:"; 444 526 // 445 527 // xAxisTabPage … … 704 786 // 705 787 this.errorProvider.ContainerControl = this; 788 // 789 // titleFontDialog 790 // 791 this.titleFontDialog.FontMustExist = true; 792 this.titleFontDialog.ShowColor = true; 706 793 // 707 794 // DataTableVisualPropertiesControl … … 725 812 this.xAxisSecondaryMinimumPanel.PerformLayout(); 726 813 this.axisTabControl.ResumeLayout(false); 814 this.mainTabPage.ResumeLayout(false); 815 this.mainTabPage.PerformLayout(); 727 816 this.xAxisTabPage.ResumeLayout(false); 728 817 this.yAxisTabPage.ResumeLayout(false); … … 802 891 private System.Windows.Forms.RadioButton yAxisPrimaryMinimumAutoRadioButton; 803 892 private System.Windows.Forms.ErrorProvider errorProvider; 893 private System.Windows.Forms.TabPage mainTabPage; 894 private System.Windows.Forms.FontDialog titleFontDialog; 895 private System.Windows.Forms.Button titleFontButton; 896 private System.Windows.Forms.Label label2; 897 private System.Windows.Forms.Button axisFontButton; 898 private System.Windows.Forms.Label label3; 899 private System.Windows.Forms.Label axisFontLabel; 900 private System.Windows.Forms.Label titleFontLabel; 901 private System.Windows.Forms.FontDialog axisFontDialog; 804 902 } 805 903 } -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.cs
r6014 r6020 20 20 #endregion 21 21 22 using System.Drawing; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.MainForm; … … 47 48 try { 48 49 if (Content == null) { 50 titleFontLabel.Text = "( )"; 51 axisFontLabel.Text = "( )"; 52 49 53 xAxisPrimaryTitleTextBox.Text = string.Empty; 50 54 xAxisPrimaryMinimumAutoRadioButton.Checked = false; … … 77 81 yAxisSecondaryMaximumFixedTextBox.Text = string.Empty; 78 82 } else { 83 titleFontLabel.Text = "( " + FormatFont(Content.TitleFont) + " )"; 84 axisFontLabel.Text = "( " + FormatFont(Content.AxisTitleFont) + " )"; 85 79 86 xAxisPrimaryTitleTextBox.Text = Content.XAxisTitle; 80 87 xAxisPrimaryMinimumAutoRadioButton.Checked = Content.XAxisMinimumAuto; … … 348 355 } 349 356 } 357 358 private void titleFontButton_Click(object sender, System.EventArgs e) { 359 titleFontDialog.Font = Content.TitleFont; 360 titleFontDialog.Color = Content.TitleColor; 361 if (titleFontDialog.ShowDialog() == DialogResult.OK) { 362 Content.TitleFont = titleFontDialog.Font; 363 Content.TitleColor = titleFontDialog.Color; 364 titleFontLabel.Text = "( " + FormatFont(Content.TitleFont) + " )"; 365 } 366 } 367 368 private void axisFontButton_Click(object sender, System.EventArgs e) { 369 axisFontDialog.Font = Content.AxisTitleFont; 370 axisFontDialog.Color = Content.AxisTitleColor; 371 if (axisFontDialog.ShowDialog() == DialogResult.OK) { 372 Content.AxisTitleFont = axisFontDialog.Font; 373 Content.AxisTitleColor = axisFontDialog.Color; 374 axisFontLabel.Text = "( " + FormatFont(Content.AxisTitleFont) + " )"; 375 } 376 } 350 377 #endregion 378 379 private string FormatFont(Font f) { 380 if (f == null) return string.Empty; 381 else return f.Name + ", " + f.SizeInPoints.ToString() + "pt, " + f.Style.ToString(); 382 } 351 383 } 352 384 } -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.resx
r6014 r6020 121 121 <value>17, 17</value> 122 122 </metadata> 123 <metadata name="titleFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 <value>140, 17</value> 125 </metadata> 126 <metadata name="axisFontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 127 <value>272, 17</value> 128 </metadata> 123 129 </root> -
branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs
r6016 r6020 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common.Resources; 25 using HeuristicLab.Core;26 26 27 27 namespace HeuristicLab.Analysis.Views { 28 28 public partial class DataTableVisualPropertiesDialog : Form { 29 protected bool SuppressEvents { get; set; } 29 30 protected DataTable Content { get; private set; } 30 31 private DataTableVisualProperties originalDataTableVPs; … … 58 59 59 60 private void seriesListView_SelectedIndexChanged(object sender, System.EventArgs e) { 60 if (seriesListView.SelectedItems.Count == 0) return; 61 string rowName = seriesListView.SelectedItems[0].Text; 62 dataRowVisualPropertiesControl.Content = Content.Rows[rowName].VisualProperties; 61 if (!SuppressEvents) { 62 if (seriesListView.SelectedItems.Count != 1) { 63 dataRowVisualPropertiesControl.Content = null; 64 } else { 65 string rowName = seriesListView.SelectedItems[0].Text; 66 dataRowVisualPropertiesControl.Content = Content.Rows[rowName].VisualProperties; 67 } 68 } 63 69 } 64 70 … … 80 86 if (seriesListView.SelectedIndices.Count == 1 && seriesListView.SelectedIndices[0] > 0) { 81 87 int index = seriesListView.SelectedIndices[0]; 82 seriesListView.BeginUpdate(); 83 ListViewItem selectedSeriesItem = seriesListView.Items[index]; 84 seriesListView.Items.RemoveAt(index); 85 ListViewItem temp = seriesListView.Items[index - 1]; 86 seriesListView.Items.RemoveAt(index - 1); 87 seriesListView.Items.Insert(index - 1, selectedSeriesItem); 88 seriesListView.Items.Insert(index, temp); 89 seriesListView.EndUpdate(); 88 SuppressEvents = true; 89 try { 90 seriesListView.BeginUpdate(); 91 ListViewItem selectedSeriesItem = seriesListView.Items[index]; 92 seriesListView.Items.RemoveAt(index); 93 ListViewItem temp = seriesListView.Items[index - 1]; 94 seriesListView.Items.RemoveAt(index - 1); 95 seriesListView.Items.Insert(index - 1, selectedSeriesItem); 96 seriesListView.Items.Insert(index, temp); 97 seriesListView.SelectedIndices.Clear(); 98 seriesListView.EndUpdate(); 99 } finally { SuppressEvents = false; } 100 seriesListView.SelectedIndices.Add(index - 1); 90 101 UpdateAllSeriesPositions(); 91 102 } … … 95 106 if (seriesListView.SelectedIndices.Count == 1 && seriesListView.SelectedIndices[0] < seriesListView.Items.Count - 1) { 96 107 int index = seriesListView.SelectedIndices[0]; 97 seriesListView.BeginUpdate(); 98 ListViewItem temp = seriesListView.Items[index + 1]; 99 seriesListView.Items.RemoveAt(index + 1); 100 ListViewItem selectedSeriesItem = seriesListView.Items[index]; 101 seriesListView.Items.RemoveAt(index); 102 seriesListView.Items.Insert(index, temp); 103 seriesListView.Items.Insert(index + 1, selectedSeriesItem); 104 seriesListView.EndUpdate(); 108 SuppressEvents = true; 109 try { 110 seriesListView.BeginUpdate(); 111 ListViewItem temp = seriesListView.Items[index + 1]; 112 seriesListView.Items.RemoveAt(index + 1); 113 ListViewItem selectedSeriesItem = seriesListView.Items[index]; 114 seriesListView.Items.RemoveAt(index); 115 seriesListView.Items.Insert(index, temp); 116 seriesListView.Items.Insert(index + 1, selectedSeriesItem); 117 seriesListView.SelectedIndices.Clear(); 118 seriesListView.EndUpdate(); 119 } finally { SuppressEvents = false; } 120 seriesListView.SelectedIndices.Add(index + 1); 105 121 UpdateAllSeriesPositions(); 106 122 } … … 109 125 #region Helpers 110 126 private void UpdateAllSeriesPositions() { 111 NamedItemCollection<DataRow> rows = (NamedItemCollection<DataRow>)Content.Rows.Clone();127 Dictionary<string, DataRow> rows = Content.Rows.ToDictionary(x => x.Name); 112 128 Content.Rows.Clear(); 113 129 for (int i = 0; i < seriesListView.Items.Count; i++) { -
branches/histogram/HeuristicLab.Analysis/3.3/DataVisualization/DataTableVisualProperties.cs
r6014 r6020 21 21 22 22 using System.ComponentModel; 23 using System.Drawing; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 30 31 [StorableClass] 31 32 public class DataTableVisualProperties : DeepCloneable, INotifyPropertyChanged { 33 private Font titleFont; 34 public Font TitleFont { 35 get { return titleFont; } 36 set { 37 if (titleFont == null || value == null 38 || titleFont.Name != value.Name || titleFont.Size != value.Size || titleFont.Style != value.Style) { 39 titleFont = value; 40 OnPropertyChanged("TitleFont"); 41 } 42 } 43 } 44 private Color titleColor; 45 public Color TitleColor { 46 get { return titleColor; } 47 set { 48 if (titleColor != value) { 49 titleColor = value; 50 OnPropertyChanged("TitleFontColor"); 51 } 52 } 53 } 54 private Font axisTitleFont; 55 public Font AxisTitleFont { 56 get { return axisTitleFont; } 57 set { 58 if (axisTitleFont == null || axisTitleFont == null 59 || axisTitleFont.Name != value.Name || axisTitleFont.Size != value.Size || axisTitleFont.Style != value.Style) { 60 axisTitleFont = value; 61 OnPropertyChanged("AxisTitleFont"); 62 } 63 } 64 } 65 private Color axisTitleColor; 66 public Color AxisTitleColor { 67 get { return axisTitleColor; } 68 set { 69 if (axisTitleColor != value) { 70 axisTitleColor = value; 71 OnPropertyChanged("AxisTitleColor"); 72 } 73 } 74 } 32 75 private string xAxisTitle; 33 76 public string XAxisTitle { … … 263 306 264 307 #region Persistence Properties 308 [Storable(Name = "TitleFont")] 309 private Font StorableTitleFont { 310 get { return titleFont; } 311 set { titleFont = value; } 312 } 313 [Storable(Name = "TitleColor")] 314 private Color StorableTitleColor { 315 get { return titleColor; } 316 set { titleColor = value; } 317 } 318 [Storable(Name = "AxisTitleFont")] 319 private Font StorableAxisTitleFont { 320 get { return axisTitleFont; } 321 set { axisTitleFont = value; } 322 } 323 [Storable(Name = "AxisTitleColor")] 324 private Color StorableAxisTitleColor { 325 get { return axisTitleColor; } 326 set { axisTitleColor = value; } 327 } 265 328 [Storable(Name = "XAxisTitle")] 266 329 private string StorableXAxisTitle { … … 369 432 protected DataTableVisualProperties(DataTableVisualProperties original, Cloner cloner) 370 433 : base(original, cloner) { 434 if (original.titleFont != null) 435 this.titleFont = (Font)original.titleFont.Clone(); 436 if (original.axisTitleFont != null) 437 this.axisTitleFont = (Font)original.axisTitleFont.Clone(); 371 438 this.xAxisTitle = original.xAxisTitle; 372 439 this.yAxisTitle = original.yAxisTitle; … … 391 458 } 392 459 public DataTableVisualProperties() { 460 titleColor = Color.Black; 461 axisTitleColor = Color.Black; 393 462 this.xAxisTitle = string.Empty; 394 463 this.yAxisTitle = string.Empty; -
branches/histogram/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj
r5698 r6020 208 208 <Compile Include="Default\Xml\Primitive\SimpleNumber2XmlSerializerBase.cs" /> 209 209 <Compile Include="Default\Xml\Primitive\String2XmlSerializer.cs" /> 210 <Compile Include="Default\Xml\Primitive\System.Drawing\Font2XmlSerializer.cs" /> 210 211 <Compile Include="Default\Xml\Primitive\TimeSpan2XmlSerializer.cs" /> 211 212 <Compile Include="Default\Xml\Primitive\UInt2XmlSerializer.cs" />
Note: See TracChangeset
for help on using the changeset viewer.