Page 1 of 1
DateTime Format on Bottom Axis
Posted: Mon Feb 17, 2014 12:05 pm
by 10548466
Hi,
I cannot format a datetime field to mm/yyyy or anything else format it shows full date and time.
I tried to format on the field properties at the dataset (cdsViewData), also in chart properties displaydateformat on bottom axis,
and i paste code in form event OnGetAxisLabel and in initialize form event...
But nothing works!
Please help,
Thanks a lot
Versions:
Delphi 7
Teechart Pro v8.07.70413
Re: DateTime Format on Bottom Axis
Posted: Mon Feb 17, 2014 12:39 pm
by yeray
Hello,
I can show dates in mm/yyyy DateTimeFormat without problems in the following simple example with Delphi 7 and TeeChart v8.08:
Code: Select all
uses Chart, Series, DateUtils, TeeProcs;
var Chart1: TChart;
procedure TForm1.FormCreate(Sender: TObject);
var tmpDate: TDateTime;
i: Integer;
begin
Chart1:=TChart.Create(Self);
Chart1.Parent:=Self;
Chart1.Align:=alClient;
Chart1.View3D:=false;
with Chart1.AddSeries(TLineSeries) as TLineSeries do
begin
XValues.DateTime:=true;
tmpDate:=Today;
for i:=0 to 5 do
begin
AddXY(tmpDate, random*100);
tmpDate:=IncMonth(tmpDate);
end;
end;
Chart1.Axes.Bottom.Increment:=DateTimeStep[dtOneMonth];
Chart1.Axes.Bottom.DateTimeFormat:='mm/yyyy';
end;
Maybe there's some problem in your code. Please, try to arrange a simple example project we can run as-is to reproduce the problem here and we'll be glad to take a look at it.
Re: DateTime Format on Bottom Axis
Posted: Mon Feb 17, 2014 1:49 pm
by 10548466
Bottom Axis Labels are automatic from database values that is datetime field.
So, i have
Datetime,Measure
01/01/2010 11:53:00, measurevalue1
02/01/2010 11:00:00, measurevalue2 etc..
And i want to show on diagram only 'mm/yyyy' but if i make another column in database with this string like
String, Measure
01/2010, measurevalue1
01/2010, measurevalue2 etc..
then i have no average function for my measure and measure it is not sum!
Is there any solution or i have to write code for each xy value ?
Thnx
Re: DateTime Format on Bottom Axis
Posted: Wed Feb 19, 2014 2:25 pm
by narcis
Hi bsoft,
Have you set series X values to contain DateTime data? For example: