How to display irregular date/time labels.

If a handler is attached to the OnDrawDateLabel event, it is called repeatedly to return the date/time of each label in turn. For this example, we'll label the first day of each month (although the ChartAppearance.DateTimeFormat property could be set to "MMM" so that only the month name would be shown.)

  procedure TForm1.RACDrawDateLabel(Sender: TObject;
                                    var DateTime: TDateTime);
    y, m, d: word;
    DecodeDate(DateTime, y, m, d);
    // find date of first day of next month
    if m = 13 then begin
      m := 1;
    // add MonthDays div 2 to centre label within the month
    DateTime := EncodeDate(y, m, 1) + MonthDays[IsLeapYear(y), m] div 2;

Note: This event handler can be invoked many times a second while the user is dragging the chart or an allocation. It is important that it completes quickly in order to maintain a responsive user experience.

What People Say

... The conclusion cannot be an other one than to state that if you are looking for a planning component you have to get the RAC. For your future planning business it is simply a must.
H. de Boer, Staaf Automatisering (see the full case study)
More …

No malware No spam
McAfee Site Report
Web of Trust