How Do I get X,Y,Z point of Contour Point?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

How Do I get X,Y,Z point of Contour Point?

Post by Dave » Mon Mar 16, 2009 10:08 pm

Hello

My chart is displaying about 10 contours. I want to let the user move a cursor tool round the chart. When the cursor tool moves over a contour point I would like the contour to turn white and the X,Y,Z coordinates of the contour series to be displayed (in the window Text property would be fine).

Ive a list of contours that have been added to Chart1 ie.

List<Contour> voltageContours;

The Chart is displayed in 2D

Ive defined a cursor tool thus;

Cursor1 = new Steema.TeeChart.Tools.CursorTool(Chart1.Chart);
Cursor1.Change += new CursorChangeEventHandler(Cursor1_Change);
Cursor1.FollowMouse = true;
Cursor1.Style = Steema.TeeChart.Tools.CursorToolStyles.Both;


Im unsure how to proceed from here.

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Tue Mar 17, 2009 8:46 am

"When the cursor tool moves over a contour point I would like the contour to turn white and the X,Y,Z coordinates of the contour series to be displayed (in the window Text property would be fine). "

Just to clarify, I need to X,Y,Z point of the contour POINT that the cursor tool is currently hovering over.

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 11:07 am

Hi Dave,

Could you take a look at this example and see if it does what you are requesting?

Code: Select all

        Steema.TeeChart.Tools.CursorTool Cursor1;
        Steema.TeeChart.Styles.Contour contour1;
        int LastClicked;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            chartController1.Chart = tChart1;

            contour1 = new Steema.TeeChart.Styles.Contour(tChart1.Chart);
            tChart1.Series[0].FillSampleValues(25);

            contour1.Pointer.Visible = true;
            contour1.UseColorRange = false;
            contour1.UsePalette = false;
            contour1.Color = Color.Blue;
            contour1.Brush.Visible = false;

            LastClicked = -1;

            Cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);

            Cursor1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(Cursor1_Change);
            Cursor1.FollowMouse = true;
            Cursor1.Style = Steema.TeeChart.Tools.CursorToolStyles.Both;          
        }

        void Cursor1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
        {
            this.Text = "X: " + e.XValue.ToString() + "   Y: " + e.YValue.ToString();

            int ClickedIndex = contour1.Clicked(tChart1.Axes.Bottom.CalcPosValue(e.XValue), tChart1.Axes.Left.CalcPosValue(e.YValue));

            if ((LastClicked != ClickedIndex) && (LastClicked > -1))
            {
                contour1.Levels[LastClicked].Color = contour1.Color;
            }

            if (ClickedIndex > -1)
            {
                this.Text = this.Text + "   Clicked!";
                contour1.Levels[ClickedIndex].Color = Color.Black;
                LastClicked = ClickedIndex;
            }
        }
Note that contour series shows many points created internally and they aren't present at the valuelist. So it wouldn't be easy to change these "virtual" points.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Thu Mar 19, 2009 8:59 am

Thanks Yeray. That looks promising. I'll try it out and let you know how I get on.

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Thu Mar 26, 2009 2:39 pm

Hi Yeray

OK Ive finally got round to trying this out. Im trying exactly the code above.
But when I move the pointer over the graph it never "hits" the graph. By that I mean "this.Text" never contains "Clicked!".

This applies even when I click with the mouse. The graph also does not change colour when I move the mouse over it.

I'll have a further look and see if I can spot why it doesnt work. If you see an obvious reason why this isnt working please let me know.

Thanks.

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

Post by Yeray » Thu Mar 26, 2009 4:11 pm

Hi Dave,

Could you please check out that you are using the latest NET version available? Here, the code above is working as expected with v3.5.3317.17532 and also using the maintenance released today.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Fri Mar 27, 2009 11:40 am

Yeray

Ive just downloaded what I believe is the latest .NET version from the website. The version number is 3.5.3371.26406

The code still doesn't do what I want.

I dont know how to load the maintenance update you mention. Can you direct me to the download page. Thanks.

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

Post by Yeray » Fri Mar 27, 2009 12:40 pm

Dave wrote:I dont know how to load the maintenance update you mention. Can you direct me to the download page. Thanks.
I meant I recommend you to download the latest release but it's the one you've just said (3.5.3371.26406).

So, please, verify that the dll in the references list of your solution is the same. And if everything seems correct, please, send us the entire solution and we'll try to see if you are doing something wrong.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Fri Mar 27, 2009 2:23 pm

Yeray
Yes this DLL is referenced OK.

Since Ive downloaded the updated version of TeeChart PRO. Im getting the following error in licences.licx

Error 17 Unable to resolve type 'Steema.TeeChart.TChart, TeeChart,

Do I need a new public key token?

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

Post by Narcís » Fri Mar 27, 2009 2:37 pm

Hi Dave,

This is the same problem as discussed here.

You may also want to check what I described on this thread.

Thanks in advance.
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Mon Mar 30, 2009 10:03 am

Thanks Narcis. Fixed it.



Yeray

The code at the top works perfectly OK in a demo app I set up. It works for both the new and older versions of the TeeChart.dll
It must be something Ive set up in my own application when I port the code over thats causing it not to work. I should be able to work out whats the problem. Thanks.

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

Post by Yeray » Mon Mar 30, 2009 11:40 am

Hi Dave,

If you are able to reproduce it in a -as simple as possible- application, feel free to send it to us and we'll try to see where is the problem.
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