Page 1 of 1

Wrong Data shown in TChartEditor using DateTime Values

Posted: Thu Aug 20, 2009 8:53 am
by 9236620
Hi,

If I add DateTime Values to the bottom axis an open a Charteditor at runtime, the x values are shown correctly but the y values show the DatTime FormatString ('hh:mm') instead of the correct data. y data points are simple integer values.

See attachment.

Any suggestion about that behavior?
TeeChart 8 pro / RAD 2009

Regards, Messie

Re: Wrong Data shown in TChartEditor using DateTime Values

Posted: Fri Aug 21, 2009 10:34 am
by yeray
Hi Messie,

Could you please attach a simple example project we can run as-is to reproduce the problem here?
The following code seems to work as expected here:

Code: Select all

uses Series, GanttCh;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TGanttSeries;
    i: Integer;
begin
  Series1 := TGanttSeries.Create(self);
  Chart1.AddSeries(Series1);

  for i := 0 to 9 do
    Series1.AddGantt(Now()+i, Now()+i+10, random*100);
end;

Re: Wrong Data shown in TChartEditor using DateTime Values

Posted: Tue Aug 25, 2009 3:47 pm
by 9236620
Ok, here we are.

Regards, Messie

Re: Wrong Data shown in TChartEditor using DateTime Values

Posted: Wed Aug 26, 2009 3:20 pm
by yeray
Hi Messie,

I see in your project that you've changed you series' ValueFormat from #,##0.### to hh:mm at design time. Note that this is for the YValues, so here it is the explanation of your result.

If you still find problems with anything, don't hesitate to let us know.

Re: Wrong Data shown in TChartEditor using DateTime Values

Posted: Thu Aug 27, 2009 7:01 am
by 9236620
Yes, you're right. I thought that this was the correct position to set. So where can I set the format string for the DateTime X Axis?

Thanks, Ulfert

Re: Wrong Data shown in TChartEditor using DateTime Values

Posted: Thu Aug 27, 2009 7:52 am
by yeray
Hi Messie,

To show hours:minutes in the bottom axis you should do as follows:

Code: Select all

  Series1.XValues.DateTime := true;
  Chart1.Axes.Bottom.DateTimeFormat := 'hh:mm';
Note that this is explained at the Tutorial 4 - Axis Control. You'll find tutorials and demos at TeeChart programs group.