Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/17 14:01:44 (7 years ago)
Author:
mkommend
Message:

#2765: Implemented tags for data points in ScatterPlot.

Location:
trunk/sources/HeuristicLab.Analysis.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.Designer.cs

    r14826 r14860  
    8787      this.chart.Titles.Add(title1);
    8888      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);
    8990      this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);
    9091      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.cs

    r14826 r14860  
    2929using HeuristicLab.Collections;
    3030using HeuristicLab.Common;
     31using HeuristicLab.MainForm;
    3132using HeuristicLab.MainForm.WindowsForms;
    3233
     
    122123      foreach (var row in rows) {
    123124        RegisterScatterPlotDataRowEvents(row);
    124         Series series = new Series(row.Name) {
    125           Tag = row
    126         };
     125        Series series = new Series(row.Name) { Tag = row };
     126
    127127        if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName;
    128128        else series.LegendText = row.Name;
     129
    129130        var regressionSeries = new Series(row.Name + "_Regression") {
    130131          Tag = row,
     
    134135          Color = Color.Transparent // to avoid auto color assignment via color palette
    135136        };
     137
    136138        seriesToRegressionSeriesTable.Add(series, regressionSeries);
    137139        ConfigureSeries(series, regressionSeries, row);
    138140        FillSeriesWithRowValues(series, row);
     141
    139142        chart.Series.Add(series);
    140143        chart.Series.Add(regressionSeries);
     
    439442
    440443    #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
    441459    private void chart_MouseDown(object sender, MouseEventArgs e) {
    442460      HitTestResult result = chart.HitTest(e.X, e.Y);
     
    511529          point.YValues = new double[] { value.Y };
    512530        }
     531        point.Tag = value.Tag;
    513532        series.Points.Add(point);
    514533        if (value.X != 0.0f)
     
    604623      double cov = sxy / n - sx * sy / n / n;
    605624      // standard error of x
    606       double sigmaX = Math.Sqrt(sxx / n -  sx * sx / n / n);
     625      double sigmaX = Math.Sqrt(sxx / n - sx * sx / n / n);
    607626      // standard error of y
    608       double sigmaY = Math.Sqrt(syy / n -  sy * sy / n / n);
     627      double sigmaY = Math.Sqrt(syy / n - sy * sy / n / n);
    609628
    610629      // correlation
Note: See TracChangeset for help on using the changeset viewer.