Problem with the DragMarks Tool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Problem with the DragMarks Tool

Post by Jeff » Tue Apr 03, 2007 11:24 pm

After the Mark of a series point is dragged with a DragMarks Tool, it won't be able to follow the series point correctly - or in another word, the Mark is kind of detached from the series point - if the user scroll the chart (by setting TChart.Panning.Allow = ScrollModes.Both in code). Any comments?

Thanks.

Jeff

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Thu Apr 05, 2007 9:59 am

Hi Jeff

I could reproduce the issue here and this seems to be a bug. I've added it (TF02012156) to our defect list to be fixed for future releases.

You can't set a custom position for marks callout. An alternative is using Annotation tools, but they don't support dragging, so we have arranged and example where we also implemented dragging support for annotation tools. This is the example's code:

Code: Select all

        private bool IsDragging;
        private int Fitem;
        private bool IsScrolling=false;
        private double MinX0;
        private double MinY0;
        
        private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            line1.FillSampleValues();

            Bitmap bmp = tChart1.Bitmap; 
            //After populating series, Create Annotation Tools
            for (int i = 0; i < line1.Count; i++)
            {
                Steema.TeeChart.Tools.Annotation AnnotationTool = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
                AnnotationTool.Callout.Arrow.Visible = true;
                AnnotationTool.Text = line1.YValues[i].ToString();
                MoveAnnotation(AnnotationTool, i);
            }
        }

        private void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            int i = 0;
            
            if (e.Button != tChart1.Panning.MouseButton)
            {
                foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
                {
                    if (at.Shape.ShapeBounds.Contains(e.X, e.Y))
                    {
                        IsDragging = true;
                        Fitem = i;
                        tChart1.Zoom.Active = false;
                        break;
                    }
                    i++;
                } 
            }

            MinX0 = tChart1.Axes.Bottom.Minimum;
            MinY0 = tChart1.Axes.Left.Minimum;
        }

        
        
        private void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if ((IsDragging))
            {
                MoveAnnotation(((Steema.TeeChart.Tools.Annotation)tChart1.Tools[Fitem]), Fitem, e.X, e.Y);
            }
            else if (IsScrolling)
            {
                int i = 0;
                foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
                {
                    int HOffset = tChart1.Axes.Bottom.CalcXPosValue(tChart1.Axes.Bottom.Minimum) - tChart1.Axes.Bottom.CalcXPosValue(MinX0);
                    int VOffset = tChart1.Axes.Left.CalcYPosValue(tChart1.Axes.Left.Minimum) - tChart1.Axes.Left.CalcYPosValue(MinY0);

                    MoveAnnotation(at, i, at.Shape.Left - HOffset, at.Shape.Top - VOffset);
                    i++;
                } 
                
            }            
           
            MinX0 = tChart1.Axes.Bottom.Minimum;
            MinY0 = tChart1.Axes.Left.Minimum;
           
        }
   
        private void tChart1_MouseUp(object sender, MouseEventArgs e)
        {
            IsDragging = false;
            IsScrolling = false;
            tChart1.Zoom.Allow = true;
        }


        private void tChart1_Scroll(object sender, EventArgs e)
        {
            IsScrolling = true;
        }

        private void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            SetAnnotationsPosition();
        }

        private void tChart1_Zoomed(object sender, EventArgs e)
        {
            SetAnnotationsPosition();
        }

        private void SetAnnotationsPosition()
        {
            Bitmap bmp = tChart1.Bitmap;

            int i = 0;
            foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
            {
                MoveAnnotation(at, i);
                i++;
            }
        }

        private void MoveAnnotation(Steema.TeeChart.Tools.Annotation a, int index)
        {
            a.Left = line1.CalcXPos(index) - 15;
            a.Top = line1.CalcYPos(index) - 20;
            a.Callout.XPosition = line1.CalcXPos(index);
            a.Callout.YPosition = line1.CalcYPos(index);
        }

        private void MoveAnnotation(Steema.TeeChart.Tools.Annotation a, int index, int HOffset, int VOffset)
        {
            a.Left = HOffset;
            a.Top = VOffset;
            a.Callout.XPosition = line1.CalcXPos(index);
            a.Callout.YPosition = line1.CalcYPos(index);
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Andrew S
Newbie
Newbie
Posts: 42
Joined: Wed Jul 28, 2004 4:00 am

Post by Andrew S » Wed Feb 13, 2008 4:22 pm

Is there still a plan to resolve this issue in a future build? I'm still experiencing the exact same problem using TeeChart Pro 8.02.

Andrew

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

Post by Narcís » Thu Feb 14, 2008 10:40 am

Hi Andrew,

Yes, this is a common issue to all TeeChart versions and it is still an open issue at the defect list to be fixed for future releases.
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

Post Reply