Mark Position not correct after zoom?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Mark Position not correct after zoom?

Post by swong » Mon Jan 19, 2004 11:58 pm

After plotting the graph I "hand" move some of the Marks around using the DragMarks tool. The Marks also have the arrows turned on, and a color assigned to the line.

After zooming in, or out, the connecting lines no longer are correct.

mySeries.Marks.Arrow.Visible = true;
mySeries.Marks.Arrow.Color = System.Drawing.Color.DarkGray;

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Tue Jan 20, 2004 8:31 am

Hi.

This is as designed. Customer positions (for series marks and also for other objects on chart) are always expressed in screen pixel coordinates. When you, for example, move the mark to screen point (100,100), it will stay there even if you scroll, zoom, export to image, print .... chart.

A solution to your problem is to express custom position in (real) axis coordinates and then in one of chart or series events adjust custom position according to this (saved) real position. Basically, do the following:

1) When you initially move series mark, transform it's position from screen coordinates to axis coordinates. You can use axis CalcPosPoint method to do this.
2) Later in one of chart evens, use these saved values to reposition series mark(s). You can use chart axis CalcPosValue method to transform from real back to screen coordinates.

Using this approach mark position will be adjusted if you zoom scroll and even print chart.
Marjan Slatinek,
http://www.steema.com

swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Post by swong » Tue Jan 20, 2004 9:08 pm

Thanks for the information. Although I don't think I know how to implement this. I cannot find a public event for tracking the mouse movement in the DragMarks class. Without that, is there another way of implementing a click-and-drag action for a mark?


Thanks again!

swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Post by swong » Sat Feb 07, 2004 2:31 am

Hi,

Haven't heard about this in a little while. Just wondering if there's been any progress.

Also, I seem to have another problem. If the chart is resized (ie. docking it to all corners), the marks are also incorrect.

This also occurs if I right-mouse click & drag

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Feb 09, 2004 10:12 pm

Hi.
Also, I seem to have another problem. If the chart is resized (ie. docking it to all corners), the marks are also incorrect.
This falls into the same category. When you drag marks around, you're defining their custom position (expressed in screen pixels). And when you resize chart/form, mark positions are not updated (see my first reply in this thread).
Last edited by Marjan on Mon Feb 09, 2004 10:15 pm, edited 1 time in total.
Marjan Slatinek,
http://www.steema.com

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Feb 09, 2004 10:15 pm

8123490 wrote:I cannot find a public event for tracking the mouse movement in the DragMarks class. Without that, is there another way of implementing a click-and-drag action for a mark?
Sure. You could use one of chart or series event to check mark custom positions and then later in chart OnAfterDraw event do the adjustments. For example, you could use series AfterDrawValues event to cycle through all series marks and if mark position is customized, to the translation and store it in array (or collection, list, ...). Then in chart OnAfterDraw event do the reverse thing (see my original reply in this thread).
Marjan Slatinek,
http://www.steema.com

swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Post by swong » Tue Feb 10, 2004 7:25 pm

I can understand why the Mark would be implemented using screen coordinates, but my concern is with the connecting line. It seems to be rendered using screen coordinates as well.

I have the following questions about your implementation:
- How do I know that the mark has been customized?
- How to I make the connecting line connect properly?

Post Reply