Changeset 14860
- Timestamp:
- 04/13/17 14:01:44 (8 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.Designer.cs
r14826 r14860 87 87 this.chart.Titles.Add(title1); 88 88 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 89 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDoubleClick); 89 90 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 90 91 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); -
trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.cs
r14826 r14860 29 29 using HeuristicLab.Collections; 30 30 using HeuristicLab.Common; 31 using HeuristicLab.MainForm; 31 32 using HeuristicLab.MainForm.WindowsForms; 32 33 … … 122 123 foreach (var row in rows) { 123 124 RegisterScatterPlotDataRowEvents(row); 124 Series series = new Series(row.Name) { 125 Tag = row 126 }; 125 Series series = new Series(row.Name) { Tag = row }; 126 127 127 if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName; 128 128 else series.LegendText = row.Name; 129 129 130 var regressionSeries = new Series(row.Name + "_Regression") { 130 131 Tag = row, … … 134 135 Color = Color.Transparent // to avoid auto color assignment via color palette 135 136 }; 137 136 138 seriesToRegressionSeriesTable.Add(series, regressionSeries); 137 139 ConfigureSeries(series, regressionSeries, row); 138 140 FillSeriesWithRowValues(series, row); 141 139 142 chart.Series.Add(series); 140 143 chart.Series.Add(regressionSeries); … … 439 442 440 443 #region Chart Event Handlers 444 private void chart_MouseDoubleClick(object sender, MouseEventArgs e) { 445 HitTestResult result = chart.HitTest(e.X, e.Y,ChartElementType.DataPoint); 446 if (result.ChartElementType != ChartElementType.DataPoint) return; 447 448 var series = result.Series; 449 var dataPoint = series.Points[result.PointIndex]; 450 var tag = dataPoint.Tag; 451 var content = tag as IContent; 452 453 if (tag == null) return; 454 if (content == null) return; 455 456 MainFormManager.MainForm.ShowContent(content); 457 } 458 441 459 private void chart_MouseDown(object sender, MouseEventArgs e) { 442 460 HitTestResult result = chart.HitTest(e.X, e.Y); … … 511 529 point.YValues = new double[] { value.Y }; 512 530 } 531 point.Tag = value.Tag; 513 532 series.Points.Add(point); 514 533 if (value.X != 0.0f) … … 604 623 double cov = sxy / n - sx * sy / n / n; 605 624 // standard error of x 606 double sigmaX = Math.Sqrt(sxx / n - 625 double sigmaX = Math.Sqrt(sxx / n - sx * sx / n / n); 607 626 // standard error of y 608 double sigmaY = Math.Sqrt(syy / n - 627 double sigmaY = Math.Sqrt(syy / n - sy * sy / n / n); 609 628 610 629 // correlation -
trunk/sources/HeuristicLab.Common/3.3/Point2D.cs
r14185 r14860 26 26 namespace HeuristicLab.Common { 27 27 [Serializable] 28 public struct Point2D<T> where T : struct {28 public struct Point2D<T> where T : struct, IEquatable<T> { 29 29 public static readonly Point2D<T> Empty = new Point2D<T>(); 30 30 … … 38 38 } 39 39 40 private object tag; 41 public object Tag { 42 get { return tag; } 43 } 44 40 45 [Browsable(false)] 41 46 public bool IsEmpty { … … 43 48 } 44 49 45 public Point2D(T x, T y ) {50 public Point2D(T x, T y, object tag = null) { 46 51 this.x = x; 47 52 this.y = y; 53 this.tag = tag; 48 54 } 49 55 50 56 public static bool operator ==(Point2D<T> left, Point2D<T> right) { 51 return left.x.Equals(right.x) && left.y.Equals(right.y) ;57 return left.x.Equals(right.x) && left.y.Equals(right.y) && left.tag == right.tag; 52 58 } 53 59 public static bool operator !=(Point2D<T> left, Point2D<T> right) { … … 59 65 return false; 60 66 Point2D<T> point = (Point2D<T>)obj; 61 return x.Equals(point.x) && y.Equals(point.y) && GetType().Equals(point.GetType()); 67 return GetType() == point.GetType() && x.Equals(point.x) && y.Equals(point.y) && 68 ((tag != null && tag.Equals(point.tag)) || tag == point.tag); 62 69 } 63 70 public override int GetHashCode() {
Note: See TracChangeset
for help on using the changeset viewer.