How to: constant line at date values? lazarus / 55-TAChart ---------------------------------------------------------------------- madepabloh · 2012-10-09 21:20 Hi folks, I have a plot of temperature (Y) vs date and time (X). I would like to show a vertical line at the beganing of each month, at 00:00h. I know it could be done by the use of "constant line" type of serie. However, i do not figure out how to do it, because the number of lines will depends of the data the user will introduce in the plot... Any idea about how to attack this problem? Thanks! ---------------------------------------------------------------------- wp · 2012-10-10 08:00 I assume that you also want labels at these vertical lines. Then the constant line series approach is not the best one since it does not provide the labels. Why don't you just use the ordinary axis grid for your purpose? To force a major grid line at each first of a month use a TListSource instead of TDateTimeIntervalsource as the source of the axis marks. Write a procedure which does the following (not tested): Code: [Select]procedure TForm1.Upda]"]>BlockednthGrid; var   ex: TDoubleRect;   i: Integer;   d,m,y: integer;   month1: TDate; begin   ListSource1.Clear;   ex := Chart1.CurrentExtent;   DecodeDateTime(TDate(ex.a.x), y,m,d);   month1 := EncodeDateTime(y,m,1);   while month1 < ex.b.x do begin     ListSoure1.Add(month1, 0, DateToStr(month1));     inc(m);     if m = 13 then begin       m := 1;       inc(y);     end;     month1 := EncodeDateTime(y,m,1);   end; end; Call this procedure whenever the x extent changes, e.g. when the user adds or deletes data. Or, if you are using Lazarus trunk, call it from Chart1.OnExtentChanging. In order to get tick lines for the days of each month I'd add  minor marks and adjust them to an increment of 1. ---------------------------------------------------------------------- madepabloh · 2012-10-10 14:30 Thanks @wp! Other point of view. I didn´t thnik about this possibility. I will try to understand the code and try to apply it... Thanks!