DragPoint not extending outside of chart view after zooming

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

DragPoint not extending outside of chart view after zooming

Post by LibDundas » Wed May 06, 2009 6:56 pm

When not zoomed in, I am able to drag a point to the edges of the chart limit, and the chart will expand and move with my point.

For example, if my Y-axis was from 0 to 120 and I drag a point from 100 to 200, the chart would previously expand to 200.

However, when I am zoomed in, the chart does not expand automatically. Is there a setting I am missing or is this a known issue?

Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Thu May 07, 2009 10:25 am

Hello LibDundas,

I recomend use similar code for next example:


InitializeChart:

Code: Select all

       private void InitializeChart()
        {
            Steema.TeeChart.Styles.Line  line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.Pointer.Visible = true;
            Steema.TeeChart.Tools.DragPoint dgpoint = new Steema.TeeChart.Tools.DragPoint(tChart1.Chart);
            line1.FillSampleValues();
            dgpoint.Series = line1;
            dgpoint.Drag += new Steema.TeeChart.Tools.DragPointEventHandler(dgpoint_Drag);

        }
Drag Event:

Code: Select all

       void dgpoint_Drag(Steema.TeeChart.Tools.DragPoint sender, int index)
        {
      
            Steema.TeeChart.Styles.Series s = sender.Series;
            double x = s.XValues[index];
            double y = s.YValues[index];

                if (x > s.GetHorizAxis.Maximum)
                s.GetHorizAxis.Maximum = x;

                if (x < s.GetHorizAxis.Minimum)
                s.GetHorizAxis.Minimum = x;

                if (y > s.GetVertAxis.Maximum)
                s.GetVertAxis.Maximum = x;

                if (y < s.GetVertAxis.Minimum)
                s.GetVertAxis.Minimum = x;
        }

I hope you will help

Thanks,
Best Regards,
Sandra Pazos / 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

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Post by LibDundas » Thu May 07, 2009 2:18 pm

Thank you Sandra! I added in your suggestion and it worked as expected. Just 2 small typos that I corrected below to help any future readers of this post:
Drag Event:

if (x > s.GetHorizAxis.Maximum)
s.GetHorizAxis.Maximum = x;

if (x < s.GetHorizAxis.Minimum)
s.GetHorizAxis.Minimum = x;

if (y > s.GetVertAxis.Maximum)
s.GetVertAxis.Maximum = y;

if (y < s.GetVertAxis.Minimum)
s.GetVertAxis.Minimum = y;

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Fri May 08, 2009 8:19 am

Hello LibDundas,


Thanks, I had not realized :).
Best Regards,
Sandra Pazos / 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