XYZ position mouse click within 3D chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

XYZ position mouse click within 3D chart

Post by bairog » Mon Jul 10, 2006 9:31 am

I need to determine XYZ coordinates of a clicked point when someone clickes bottom plane (plane between X and Z axes). How could I do it (maybe I need to draw a surface on this plane and use some functions?)?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jul 11, 2006 11:45 am

Hi bairog,

GDI+ doesn't have 3D coordinates. However you can obtain them doing something like this:

Code: Select all

    private void tChart1_MouseClick(object sender, MouseEventArgs e)
    {
      int ZstartP = tChart1.Axes.Depth.IStartPos;
      int ZendP = tChart1.Axes.Depth.IEndPos;
      int XPos = tChart1.Axes.Bottom.Position;

      if ((e.Y <= XPos) && (e.Y >= XPos - ZendP))
      {
        double ZPos = XPos - e.Y;
        double ZVal = (tChart1.Axes.Depth.Maximum * ZPos) / ZendP;        
        double XVal = tChart1.Axes.Bottom.CalcPosPoint(e.X);
        double YVal = tChart1.Axes.Bottom.CalcPosPoint(e.X);

        tChart1.Header.Text = XVal.ToString() + ", " + YVal.ToString() + ", " + ZVal.ToString();
      }
      else
      {
        tChart1.Header.Text = "";
      }
    }
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bairog
Newbie
Newbie
Posts: 72
Joined: Fri Jul 07, 2006 12:00 am
Location: Moscow, Russia
Contact:

Post by bairog » Thu Jul 13, 2006 1:29 pm

Thank you, but you code does not work correctly in my chart.
Image
As you can see values that are shown in header are not right (more than that in you code X and Y coordinates are always the same).Moreover while rotating and elevating the chart I have the same XYZ coordinates if I click at the same XY screen position. That's why I have some questions:
1)Are you sure that the code you gave is correct?
2)What shoul I add to code to make XYZ coordinates rotation-,elevation- and zoom-dependent?
3)From what border do Position, IEndPos and IStartPos values are calculate (screen XY xoordinates as far as I know are calculated from form border) and how could I obtain this border coordinates?
Thank you.

Post Reply