Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13783


Ignore:
Timestamp:
04/21/16 17:24:10 (9 years ago)
Author:
bburlacu
Message:

#2597: Fix text annotations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs

    r13780 r13783  
    200200        var p = series.Points.Last();
    201201        vla.X = p.XValue;
    202         var ta = new TextAnnotation { Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]), Visible = true, X = p.XValue, Y = p.YValues[0] };
     202        var ta = new TextAnnotation {
     203          Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]),
     204          Visible = true,
     205          X = p.XValue,
     206          Y = p.YValues[0],
     207          AxisX = ChartAreas[0].AxisX,
     208          AxisY = ChartAreas[0].AxisY
     209        };
    203210        ta.ClipToChartArea = "ChartArea1";
     211        ta.Name = series.Name;
    204212        Annotations.Add(ta);
    205213      }
     
    334342      var x = e.NewLocationX;
    335343
    336       var va = VerticalLineAnnotation;
    337       Annotations.Clear();
    338       Annotations.Add(va);
     344      //      var va = VerticalLineAnnotation;
     345      //      Annotations.Clear();
     346      //      Annotations.Add(va);
    339347      for (int i = 0; i < solutionList.Count; ++i) {
    340348        var y = GetEstimatedValue(solutionList[i], x);
    341349        var s = Series[i];
    342350        var n = s.Points.Count;
    343         var ta = new TextAnnotation { X = x, Y = y };
    344         Annotations.Add(ta);
    345351        s.Points[n - 1] = new DataPoint(x, y) { MarkerColor = Color.Red, MarkerSize = 5 };
     352      }
     353      foreach (var annotation in Annotations.OfType<TextAnnotation>()) {
     354        var p = Series[annotation.Name].Points.Last();
     355        annotation.Text = string.Format("X: {0:0.000}, Y: {1:0.000}", p.XValue, p.YValues[0]);
     356        annotation.X = p.XValue;
     357        annotation.Y = p.YValues[0];
    346358      }
    347359      Update();
Note: See TracChangeset for help on using the changeset viewer.