Refer to below image: 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();
}
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);
}
}
Unless there is a better 'official' way .. I'll just hack this code to include the 'Space'