How to different show days of the week in different colours.
This example assumes that RAC.ChartAppearance.PlotBackAlternateInterval has been set to 1 day.
procedure TForm1.RACGetPlotBackground(Sender: TObject; Canvas: TCanvas; StartDateTime, EndDateTime: TDateTime; var Color: TColor); var dow: integer; y, m, d: word; begin // indicate today if Trunc(Now) = Trunc(StartDateTime) then Color := $DDDDFF else begin DecodeDate(StartDateTime, y, m, d); // indicate the first day of each month if d = 1 then Color := $DDFFDD else begin // colour saturdays and sundays a different shade dow := DayOfWeek(StartDateTime); if (dow = 1) or (dow = 7) then Color := $FFDDDD // alternate week days else if (dow = 2) or (dow = 4) or (dow = 6) then Color := clWhite else Color := $FFFFFA; end; end; end;Note: This event handler can be invoked many times a second while the user is dragging the chart. 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|
This is a great component. I've been using it for a year. It's well written, performance is top notch, and the couple of time I've asked for support, I've gotten it right away from the author.