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); var y, m, d: word; begin DecodeDate(DateTime, y, m, d); // find date of first day of next month inc(m); if m = 13 then begin m := 1; inc(y); end; // add MonthDays div 2 to centre label within the month DateTime := EncodeDate(y, m, 1) + MonthDays[IsLeapYear(y), m] div 2; end;
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.
- Screen Shots
- FAQ & Getting Started
- User Comments
- Support Forum
- Change History
|What People Say|
I just wanted to let you know that I love your component! I find it extensible, easy to use, and the performance is top notch. I even think I understand much of the source. You hit a home run with this one!
Tom Kopeika, Illinois