How to label the date axis with week numbers.


This example labels the date and time axis with week numbers. For this example, set DateLabelBase to a Sunday, and DateLabelInterval to 7 days. The ISOWeekNumber function can be found in JCLDateTime from the JEDI code library.

procedure TForm1.RACGetDateTimeLabelText(
                                      Sender: TObject;
                                      DateTime: TDateTime;
                                      var DateText, TimeText: string);
var
  WeekNumber: integer;
begin
  TimeText := '';
  if DayOfWeek(DateTime) = 1 then begin // label Sundays
    WeekNumber := ISOWeekNumber(DateTime);
    DateText := IntToStr(WeekNumber);
  end else
    DateText := '';
end;
What People Say

Great component...
Danny Banks, FMI Solutions Limited
More …

No malware No spam
McAfee Site Report
Web of Trust