Page 1 of 1

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

Posted: Mon Mar 16, 2009 10:08 pm
by 13050364
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.

Posted: Tue Mar 17, 2009 8:46 am
by 13050364
"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.

Posted: Wed Mar 18, 2009 11:07 am
by yeray
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.

Posted: Thu Mar 19, 2009 8:59 am
by 13050364
Thanks Yeray. That looks promising. I'll try it out and let you know how I get on.

Posted: Thu Mar 26, 2009 2:39 pm
by 13050364
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.

Posted: Thu Mar 26, 2009 4:11 pm
by yeray
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.

Posted: Fri Mar 27, 2009 11:40 am
by 13050364
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.

Posted: Fri Mar 27, 2009 12:40 pm
by yeray
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.

Posted: Fri Mar 27, 2009 2:23 pm
by 13050364
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?

Posted: Fri Mar 27, 2009 2:37 pm
by narcis
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.

Posted: Mon Mar 30, 2009 10:03 am
by 13050364
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.

Posted: Mon Mar 30, 2009 11:40 am
by yeray
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.