Surface editing

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
tombradshaw
Newbie
Newbie
Posts: 5
Joined: Tue May 18, 2004 4:00 am

Surface editing

Post by tombradshaw » Thu May 20, 2004 4:04 pm

Hi,
I want to create a surface chart which has 3 features:-
1) The user can select the X and Z values and a pen image should then be draw at the Z point on the surface, I can draw the pen but I am lost as to how to calculate the X Y Screen values

2) The user should then be able to edit the value by moving the pen, I think I should be able to do this if 1) is answered.

3) If the user clicks on the graph I need to calculate the nearest X Y Z values and move the pen to this point.

I can send an example project if needed.

Thanks
Tom

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon May 24, 2004 4:32 pm

Hi, Tom.
how to calculate the X Y Screen values
If I understand you correctly, the user should be able to click on selected cell and change it's y value (TeeChart is plotting y=y(x,z)) ? If this is the case the yes, it can be done. There is an example about this available in TeeChart v7 demo. To be more precise, check the following example : "What's New -> New Chart Tools -> Surface nearest". Using this tool you should be able to find the closest point to current mouse (pen ?) position. The rest is easy. Once you know nearest point (cell) ValueIndex, you can change cell's YValue (the y=y(z,x)) by accessing YValues[Index] value.
2) The user should then be able to edit the value by moving the pen, I
For surface series this is a bit tricky because cell is defined by four points so you have to be careful which Yvalues (see above) you have to change. It all depends how you populated series with data (row-by-row or column-by-column).
3) If the user clicks on the graph I need to calculate the nearest X Y Z values and move the pen to this point.
Sure. Use the TSurfaceNearestTool tool, included with TeeChart v7.0.

tombradshaw
Newbie
Newbie
Posts: 5
Joined: Tue May 18, 2004 4:00 am

Post by tombradshaw » Tue May 25, 2004 10:11 am

I managed to get TNearestPoint working, I can edit the value so that the Y value increases when I move the mouse up and down when I move it down, but I can't get the correct value to change to so that Y point 'keeps up' with the pen, I have tried using YScreenToValue but this doesn't work for 3D, only 2D.

Also, I can get the pen drawn on a point the user clicks near, but if they rotate/ zoom etc what do I need to do to get the event and move the pen correctly? I see a OnZoom but no onrotate

Thanks

tombradshaw
Newbie
Newbie
Posts: 5
Joined: Tue May 18, 2004 4:00 am

Post by tombradshaw » Tue May 25, 2004 12:33 pm

Hi,
I'm still having trouble trying to place the pen in the correct point if I know the X Z (and even Y) values?
Thanks

Post Reply