Page 1 of 1

BottomAxis gridlines at specific X-values?

Posted: Sat Jun 19, 2004 5:00 pm
by 8441597
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.

Posted: Mon Jun 21, 2004 11:06 am
by Pep
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.