title: Get coordinates of a drawing point from Chart Values in TextBoxes?
body: <p>In the designer I have two TextBoxes.
  And also a Chart control.
  I want that when I type in the first textBox the number 120 and in the second one type the number 1 it will draw a point on the chart in 120,1 but I mean 120 and 1 as axis x and axis y values.</p>
  
  <p><img src="https://i.stack.imgur.com/rj7ku.jpg" alt="Chart"></p>
  
  <p>The red filled circle is not at 120 and 1.
  I mean that the red circle should be drawn on the left axis on 120.
  And if I will put instead 120 116 and instead 1 25 then the circle should be drawn at the left axis 116 and on the bottom axis on 25.</p>
  
  <p>But now the circle is drawn out of the chart.</p>
  
  <p>This is my code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Windows.Forms.DataVisualization.Charting;
  using System.Drawing.Drawing2D;
  using System.Collections;
  
  namespace Test
  {
      public partial class Form1 : Form
      {
          private Point startPoint = new Point();
          private Point endPoint = new Point();
          private int X = 0;
          private int Y = 0;
          private List&lt;Point&gt; points = new List&lt;Point&gt;();
          private Point lastPoint = Point.Empty;
          private ArrayList myPts = new ArrayList();
  
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              Random rdn = new Random();
              for (int i = 120; i &gt; 0; i--)
              {
                  chart1.Series["Series1"].Points.AddXY
                      (rdn.Next(0, 10), rdn.Next(0, 10));
              }
  
              chart1.Series["Series1"].ChartType = SeriesChartType.FastLine;
              chart1.Series["Series1"].Color = Color.Red;
  
              ChartArea area = chart1.ChartAreas[0];
  
              area.AxisX.Minimum = 1;
              area.AxisX.Maximum = 30;
              area.AxisY.Minimum = 1;
              area.AxisY.Maximum = 120;
  
              LineAnnotation line = new LineAnnotation();
              Point p1 = new Point(1, 120);
              chart1.Annotations.Add(line);
              line.AxisX = area.AxisX;
              line.AxisY = area.AxisY;
              line.IsSizeAlwaysRelative = false;
              line.X = 1; line.Y = 120;
              line.Right = 30; line.Bottom = 1;
              line.LineColor = Color.Blue;
              line.LineWidth = 3;
          }
  
          SolidBrush myBrush = new SolidBrush(Color.Red);
          private void chart1_Paint(object sender, PaintEventArgs e)
          {            
              Graphics g = e.Graphics;
              foreach (Point p in myPts)
              g.FillEllipse(myBrush, p.X, p.Y, 10, 10);            
          }
  
          private void chart1_MouseClick(object sender, MouseEventArgs e)
          {
              myPts.Add(new Point(X,Y));
              chart1.Invalidate();
          }
  
          private void txtT_TextChanged(object sender, EventArgs e)
          {
              X = int.Parse(txtWeight.Text);
          }
  
          private void txtDays_TextChanged(object sender, EventArgs e)
          {
              Y = int.Parse(txtDays.Text);
          }
      }
  }
  </code></pre>
  
  <p>What I did is that after I enter both textBoxes values then when I click anywhere on the Chart control area with the mouse it should draw the circule on the coordinates from the TextBoxes.</p>
  
  <p>But the circle is not drawing on the right place.</p>
  
  <p>The textBox name txtT is the left one the axis on the left values.
  The textBox txtDays should is the axis on the bottom values.</p>