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.