I use D2007 and Teechart v7.10 standard I want to show the data per week. I set
Series1.GetHorizAxis.Increment := DateTimeStep[dtOneWeek];
and
chart1.TopAxis.minimum = //a Monday's date
The problem is that the vertical separation lines and their dates aren't on Mondays. Is any way to force these marks to be at the start of week ? thanks in advance
Using TGantSeries
I've tried with the actual version (v2013.09) and I always get a bottom axis with labels on Mondays using the following simple example:
uses GanttCh;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.AddSeries(TGanttSeries).FillSampleValues;
with Chart1.Axes.Bottom do
begin
LabelsAngle:=90;
Increment:=DateTimeStep[dtOneWeek];
DateTimeFormat:='ddd dd/mm/yyyy';
end;
end;
However, I see in TeeChart v7 the code above shows different weekdays in the labels depending on the values in the series. Then, the only solution I can think on is to use custom labels. Ie:
uses GanttCh;
procedure TForm1.FormCreate(Sender: TObject);
var tmpDate: TDateTime;
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.AddSeries(TGanttSeries).FillSampleValues;
Chart1.MarginBottom:=15;
with Chart1.Axes.Bottom do
begin
LabelsAngle:=90;
//Increment:=DateTimeStep[dtOneWeek]; //this won't take effect with custom labels
DateTimeFormat:='ddd dd/mm/yyyy';
tmpDate:=(Chart1[0] as TGanttSeries).StartValues.MinValue;
while DayOfWeek(tmpDate) <> 2 do
tmpDate:=tmpDate+1;
Items.Clear;
repeat
Items.Add(tmpDate);
tmpDate:=tmpDate+7;
until tmpDate>=(Chart1[0] as TGanttSeries).EndValues.MaxValue;
end;
end;
Note in the solution above there's no antioverlap control for the axis labels