CHart axis area Clipping

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Snarkle
Newbie
Newbie
Posts: 91
Joined: Wed Jun 30, 2010 12:00 am

Re: Chart axis area Clipping

Post by Snarkle » Mon Dec 13, 2010 5:02 am

Greetings and now back on topic,

Refer to below image:
More ClippingFun.png
More ClippingFun.png (21.6 KiB) Viewed 2935 times
In the above picture the red circles denote where my Drawlines Clip, The top and left clip perfectly at the boundaries of the Axis, however the Bottom clips at the bottom of the axis .. there is a little gap because I've left a little space on the Y axis between the Custom axis (the orange circle) .. now this is no big deal near the bottom of the axis. On the X axis I have also left a little space (as with Bar Charts the right hand side is todays Stock price so I leave a little room so it does not crash into the right axis) sadly the Drawline is clipping at the end of the X axis .. in the picture I have scrolled the chart to the right, thats why there is no gap and the values scroll off the screen.

As suggested I've associated the drawLines with the Series in the main Axis ( myDrawLine.Series = StockChart.Series[0]; )
However I've tried to increase the size of the clipping area (in the below example I increased it to pretty much include the whole chart rect) This works for the clipping the series but the drawlines seem to ignore it completely and only uses the axis max and mins (not including the "space" thats included for readability)

Code: Select all

        private void ControlChart_BeforeDrawValues(object sender, Graphics3D g)
        {
            Rectangle rect = StockChart.Chart.ChartRect;
            int end = rect.Right;
            int start = rect.Left;

            Steema.TeeChart.Styles.Series s = sender as Steema.TeeChart.Styles.Series;
            int left = start;           // s.GetHorizAxis.IStartPos;
            int right = end;            // s.GetHorizAxis.IEndPos;
            int top = rect.Top;         // s.GetVertAxis.IStartPos;
            int bottom = rect.Bottom;   //s.GetVertAxis.IEndPos;
            StockChart.Graphics3D.ClipRectangle(left, top, right, bottom);
        }

        private void ControlChart_AfterDrawValues(object sender, Graphics3D g)
        {
            StockChart.Graphics3D.ClearClipRegions();
        } 
Is there a way to make the Drawline Clipping region larger, or not use the axis values ... ???
It does this type of clipping in both 4.0 and 4.1 (I copied across the bug fix from the drawline class from 4.1. to 4.0 that allowed me to get this far)

A little more digging and I found my problem in the DrawLine class

Code: Select all

    protected virtual void ClipDrawingRegion(Graphics3D g)
    {
#if WPF || SILVERLIGHT 
      Rect R;
#else
      Rectangle R;
#endif
      if (this.Series != null)
      {
        R = Utils.FromLTRB(this.Series.GetHorizAxis.IStartPos, this.Series.GetVertAxis.IStartPos, // <====== The Drawlines when they have a series uses Axis Istart and IEnd
          this.Series.GetHorizAxis.IEndPos, this.Series.GetVertAxis.IEndPos);
      }
      else
      {
        R = base.Chart.ChartRect;
      }
      if (base.Chart.CanClip())
      {
        g.ClearClipRegions(); 
        g.ClipCube(R, 0, base.Chart.Aspect.Width3D);
      }
    }
I see that the drawlines always use the Series.GetHorizAxis.IStartPos and this.Series.GetVertAxis.IStartPos regardless of what you set your clipping region to.
Unless there is a better 'official' way .. I'll just hack this code to include the 'Space'
--------------------
Cheers Phil.

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

Re: CHart axis area Clipping

Post by Sandra » Tue Dec 14, 2010 9:37 am

Hello Phil,

Thank you for information, but can you send us a simple project because we can reproduce exactly your problems here?


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

Post Reply