Page 1 of 1

Mark Position not correct after zoom?

Posted: Mon Jan 19, 2004 11:58 pm
by 8123490
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;

Posted: Tue Jan 20, 2004 8:31 am
by Marjan
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.

Posted: Tue Jan 20, 2004 9:08 pm
by 8123490
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!

Posted: Sat Feb 07, 2004 2:31 am
by 8123490
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

Posted: Mon Feb 09, 2004 10:12 pm
by Marjan
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).

Posted: Mon Feb 09, 2004 10:15 pm
by Marjan
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).

Posted: Tue Feb 10, 2004 7:25 pm
by 8123490
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?