Page 1 of 1

Annotation tool snap to point feature

Posted: Wed Apr 08, 2015 11:31 am
by 16071129
I use Annotation tool to wright a text on chart. which i wanted to mark a specific point on my series. But i didnt found any feature for this in Annotation tool. So i kept its position custom and set its x and y cordinates according to that point. It worked well but while Zooming Chart position of text doesnt change itself. how to change its position automatically i want it like snap to point.

Re: Annotation tool snap to point feature

Posted: Thu Apr 09, 2015 9:43 am
by Christopher
Hello!

You can tie the Annotation tool position to a particular series point position like this:

Code: Select all

    Annotation tool1;
    Line series1;

    private void InitializeChart()
    {
      series1 = new Line(tChart1.Chart);
      series1.FillSampleValues();
      series1.AfterDrawValues += series1_AfterDrawValues;
      

      tool1 = new Annotation(tChart1.Chart);
      tool1.Text = "Some text";
      tool1.Shape.CustomPosition = true;
    }

    void series1_AfterDrawValues(object sender, Graphics3D g)
    {
      tool1.Shape.Left = series1.CalcXPos(3);
      tool1.Shape.Top = series1.CalcYPos(3);
    }