Page 1 of 1

How to draw Line series on top of chart edges

Posted: Sun Dec 05, 2004 8:48 pm
by 8119814
Hi,

Line series graphs are not visible when the values are along the corresponding axes extremes (maximum or minimum). Code demonstrating this behavior is uploaded on steema.public.attachments. I want to keep the axis minimum and maximum offsets at 0. Is it possible to draw the line series graph and their pointers as the topmost element when they coincide with the chart's edges ?

Thank you.

Posted: Mon Dec 06, 2004 10:29 am
by Marjan
Hi, Lancer.

If the series Pointers are visible, then you could try setting it's InflateMargins property to true. Another trick might be to use left axis MinimumOffset and MaximumOffset properties to value greater than 0.

If none of this is acceptable, then you could also disable series points clipping by setting the tChart.Aspect.ClipPoints to false:

Code: Select all

tChart1.Aspect.ClipPoints = false;

RE: How to draw Line series on top of chart edges

Posted: Tue Dec 07, 2004 12:20 pm
by 8119814
Thanks for your quick response.

Series pointers may not be visible - so the first suggestion cannot be applied. Also, the solution should apply to FastLine series also.

And, as I mentioned in my original note, minimum and maximum offsets should remain 0 as otherwise it would affect other things in my program.

Turning off the series points clipping works well, but on a zoom-in the graph lines are drawn outside the chart rectangle also.

The answer may be to turn the built in clipping algorithm off (with the tChart1.Aspect.ClipPoints = false;) and write an external one that will clip the chart rectangle (the area enclosed by the axes) by just a few more pixels in the vertical direction. If you agree, could you let me know how to do that ?

Thank you.

Posted: Wed Dec 29, 2004 6:52 pm
by 8119814
Hi,

It has been some time since I posted my reply, but have not seen a response ... please let me know if my last suggestion will work, and if so, some guidelines/hints on implementing it.

Thank you.

Posted: Thu Dec 30, 2004 7:50 am
by Marjan
Hi, Lancer.

Yes, it can be done. You can use chart BeforeDrawSeries and AfterDraw events to clip series to specific (rectangle) region. Example:

Code: Select all

    private void tChart1_BeforeDrawSeries(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      int offset = 10;
      int l = tChart1.Axes.Left.Position-offset;
      int t = tChart1.Axes.Left.IStartPos-offset;
      int h = tChart1.Axes.Left.IEndPos +offset - t;
      int w = tChart1.Axes.Bottom.IEndPos - tChart1.Axes.Bottom.IStartPos + 2*offset;

      tChart1.Graphics3D.ClipRectangle(new Rectangle(l,t,w,h));
    }

    private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      tChart1.Graphics3D.UnClip();
    }
Of course, you can use more elaborate and complex code to define the clipping rectangle (the above is just a simple example of what you can do).