diff --git a/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs b/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs index 7d1087bf0f..526c04a65d 100644 --- a/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs +++ b/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs @@ -45,10 +45,10 @@ protected override void Dispose(bool disposing) { /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); + System.Windows.Forms.DataVisualization.Charting.ChartArea defaultChartArea = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend defaultLegend = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series defaultSeries = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.Title defaultTitle = new System.Windows.Forms.DataVisualization.Charting.Title(); this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.exportChartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -75,30 +75,30 @@ private void InitializeComponent() { | System.Windows.Forms.AnchorStyles.Right))); this.chart.BorderlineColor = System.Drawing.Color.Black; this.chart.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid; - chartArea1.CursorX.IsUserEnabled = true; - chartArea1.CursorX.IsUserSelectionEnabled = true; - chartArea1.CursorY.IsUserEnabled = true; - chartArea1.CursorY.IsUserSelectionEnabled = true; - chartArea1.Name = "ChartArea1"; - this.chart.ChartAreas.Add(chartArea1); + defaultChartArea.CursorX.IsUserEnabled = true; + defaultChartArea.CursorX.IsUserSelectionEnabled = true; + defaultChartArea.CursorY.IsUserEnabled = true; + defaultChartArea.CursorY.IsUserSelectionEnabled = true; + defaultChartArea.Name = "Default"; + this.chart.ChartAreas.Add(defaultChartArea); this.chart.ContextMenuStrip = this.contextMenuStrip; - legend1.Alignment = System.Drawing.StringAlignment.Center; - legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top; - legend1.Name = "Legend1"; - this.chart.Legends.Add(legend1); + defaultLegend.Alignment = System.Drawing.StringAlignment.Center; + defaultLegend.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top; + defaultLegend.Name = "Default"; + this.chart.Legends.Add(defaultLegend); this.chart.Location = new System.Drawing.Point(0, 52); this.chart.Name = "chart"; - series1.ChartArea = "ChartArea1"; - series1.Legend = "Legend1"; - series1.Name = "Series1"; - this.chart.Series.Add(series1); + defaultSeries.ChartArea = "Default"; + defaultSeries.Legend = "Default"; + defaultSeries.Name = "Default"; + this.chart.Series.Add(defaultSeries); this.chart.Size = new System.Drawing.Size(359, 222); this.chart.TabIndex = 4; - this.chart.Text = "chart1"; - title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - title1.Name = "Default"; - title1.Text = "Title"; - this.chart.Titles.Add(title1); + this.chart.Text = "chart"; + defaultTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + defaultTitle.Name = "Default"; + defaultTitle.Text = "Title"; + this.chart.Titles.Add(defaultTitle); this.chart.CustomizeLegend += new System.EventHandler(this.chart_CustomizeLegend); this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); diff --git a/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs b/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs index 9735fac5dc..89a5b6ff33 100644 --- a/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs +++ b/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs @@ -124,6 +124,7 @@ private void AddDataRow(DataRow row) { break; } series.YAxisType = row.VisualProperties.SecondYAxis ? AxisType.Secondary : AxisType.Primary; + if (row.VisualProperties.Color != Color.Empty) series.Color = row.VisualProperties.Color; series.ToolTip = row.Name + " X = #INDEX, Y = #VAL"; FillSeriesWithRowValues(series, row); chart.Series.Add(series); @@ -255,6 +256,7 @@ private void Row_VisualPropertiesChanged(object sender, EventArgs e) { break; } chart.Series[row.Name].YAxisType = row.VisualProperties.SecondYAxis ? AxisType.Secondary : AxisType.Primary; + if (row.VisualProperties.Color != Color.Empty) chart.Series[row.Name].Color = row.VisualProperties.Color; } } private void Row_NameChanged(object sender, EventArgs e) { diff --git a/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalyzer.cs b/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalyzer.cs index f941f60ebf..1d46c076f4 100644 --- a/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalyzer.cs +++ b/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalyzer.cs @@ -163,6 +163,7 @@ public override IOperation Apply() { DataRowVisualProperties visualProperties = new DataRowVisualProperties(); visualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Line; visualProperties.SecondYAxis = true; + visualProperties.StartIndexZero = true; allelesTable.Rows.Add(new DataRow("Unique Alleles of Best Known Solution", null, visualProperties)); allelesTable.Rows.Add(new DataRow("Fixed Alleles", null, visualProperties)); allelesTable.Rows.Add(new DataRow("Fixed Alleles of Best Known Solution", null, visualProperties)); diff --git a/sources/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs b/sources/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs index 166d02ea24..6d1c11efbd 100644 --- a/sources/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs +++ b/sources/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs @@ -22,6 +22,7 @@ using System.ComponentModel; using HeuristicLab.Common; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; +using System.Drawing; namespace HeuristicLab.Analysis { /// @@ -38,7 +39,6 @@ public enum DataRowChartType { } #endregion - [Storable(DefaultValue = DataRowChartType.Line)] private DataRowChartType chartType; public DataRowChartType ChartType { get { return chartType; } @@ -49,7 +49,6 @@ public DataRowChartType ChartType { } } } - [Storable(DefaultValue = false)] private bool secondYAxis; public bool SecondYAxis { get { return secondYAxis; } @@ -60,14 +59,61 @@ public bool SecondYAxis { } } } + private Color color; + public Color Color { + get { return color; } + set { + if (color != value) { + color = value; + OnPropertyChanged("Color"); + } + } + } + private bool startIndexZero; + public bool StartIndexZero { + get { return startIndexZero; } + set { + if (startIndexZero != value) { + startIndexZero = value; + OnPropertyChanged("StartIndexZero"); + } + } + } + + #region Persistence Properties + [Storable(Name = "ChartType")] + private DataRowChartType StorableChartType { + get { return chartType; } + set { chartType = value; } + } + [Storable(Name = "SecondYAxis")] + private bool StorableSecondYAxis { + get { return secondYAxis; } + set { secondYAxis = value; } + } + [Storable(Name = "Color")] + private Color StorableColor { + get { return color; } + set { color = value; } + } + [Storable(Name = "StartIndexZero")] + private bool StorableStartIndexZero { + get { return startIndexZero; } + set { startIndexZero = value; } + } + #endregion public DataRowVisualProperties() { chartType = DataRowChartType.Line; secondYAxis = false; + color = Color.Empty; + startIndexZero = false; } - public DataRowVisualProperties(DataRowChartType chartType, bool secondYAxis) { + public DataRowVisualProperties(DataRowChartType chartType, bool secondYAxis, Color color, bool startIndexZero) { this.chartType = chartType; this.secondYAxis = secondYAxis; + this.color = color; + this.startIndexZero = startIndexZero; } [StorableConstructor] protected DataRowVisualProperties(bool deserializing) { } @@ -76,6 +122,8 @@ public override IDeepCloneable Clone(Cloner cloner) { DataRowVisualProperties clone = (DataRowVisualProperties)base.Clone(cloner); clone.chartType = chartType; clone.secondYAxis = secondYAxis; + clone.color = color; + clone.startIndexZero = startIndexZero; return clone; }