Axis Nearest Value

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
drillright40
Newbie
Newbie
Posts: 57
Joined: Mon Nov 19, 2007 12:00 am

Axis Nearest Value

Post by drillright40 » Wed Mar 18, 2009 12:19 pm

Hello Sir,

I want to display the nearest Axis values of X,Y,Z on right clicking at a particular point of surface,in a small dialog.
How can i get these values using Steema Chart.
I have uploaded image "3D Plot.JPG" , which shows an arrow highlighting the desired value.
Please help.Thanks in Advance.

Regards,
Sanyog

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed Mar 18, 2009 3:57 pm

Hi Sanyog,

Here there is an example of how I think you could do this:

Code: Select all

        public Form1()
        {
            InitializeComponent();

            InitializeChart();
        }

        Steema.TeeChart.Styles.Surface surf1;
        Steema.TeeChart.Tools.Annotation annotation1;

        private void InitializeChart()
        {
            tChart1.Aspect.Chart3DPercent = 50;
            chartController1.Chart = tChart1;

            annotation1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
            annotation1.Active = false;

            surf1 = new Steema.TeeChart.Styles.Surface(tChart1.Chart);
            surf1.FillSampleValues(25);

            surf1.Click += new MouseEventHandler(surf1_Click);
        }

        void surf1_Click(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                int ValueIndex = ((Steema.TeeChart.Styles.Surface)sender).Clicked(e.X, e.Y);

                if (ValueIndex > -1)
                {
                    annotation1.Left = e.X;
                    annotation1.Top = e.Y;
                    annotation1.Text = "X: " + surf1.XValues.Value[ValueIndex].ToString() + "  Y: " + surf1.YValues.Value[ValueIndex].ToString() + "  Z: " + surf1.ZValues.Value[ValueIndex].ToString();
                    annotation1.Active = true;
                }
            }
            else
            {
                annotation1.Active = false;
            }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply