Page 1 of 1

DragPoint not extending outside of chart view after zooming

Posted: Wed May 06, 2009 6:56 pm
by 13052841
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

Posted: Thu May 07, 2009 10:25 am
by 10050769
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,

Posted: Thu May 07, 2009 2:18 pm
by 13052841
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;

Posted: Fri May 08, 2009 8:19 am
by 10050769
Hello LibDundas,


Thanks, I had not realized :).