BottomAxis gridlines at specific X-values?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
rotella
Newbie
Newbie
Posts: 7
Joined: Mon Nov 03, 2003 5:00 am
Location: chicago, IL

BottomAxis gridlines at specific X-values?

Post by rotella » Sat Jun 19, 2004 5:00 pm

i would like to be able to control "when" bottom axis gridlines are drawn, such that they come out on "even" calendar intervals, eg 1st day of every month, Jan 1st of every year, etc. the particular "interval" would be controlled by user or application.

i am using TDateTime XValues, and BottomAxis.isDateTime = true.

thanks in advance.

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jun 21, 2004 11:06 am

Hi,

all grid lines are drawn automatically at specified chart axis increment. If you don't specify chart axis increment, TeeChart will internally calculate it and display axis labels (and grid lines) at every increment point.
Alternatively (if you're not happy with TChart's algorithm) you can use Chart OnGetAxisLabel and OnGetNextAxisLabel events to customize axis label values and axis label increment (and thus control gridlines), or add a custom axis labels on the bottom axis (there's an example of this in the TeeChart Pro v7 Demo Features project).

An alternative solution is to manually draw vertical gridlines in Chart OnAfterDraw event. Basically, use CalcPosValue method to calculate screen position for each line and then use MoveTo + LineTo combination to draw vertical line from ChartRect.Bottom to ChartRect.Top.

Post Reply