Problem with TColorGridSeries
Posted: Fri Dec 30, 2005 8:37 am
I need to draw a graphic showing a number of events for each hour of the day for a date range (using Delphi 5/ TeeChar 6.01).
I choosed to use the TColorGridSeries graphic with these settings :
- X axis shows dates
- Z axis shows hour of the day (0-23)
- Y axis shows the number of events
I used the following code to test :
var
i,j : Integer;
time : TDateTime;
Begin
Series1.Clear;
time:=now;
for i:=0 to 23 Do
Begin
for j:=0 to 30 Do
Begin
Series1.AddXYZ(trunc(time+j),i,i);
End;
End;
end;
The Teechart object is defined as :
object Chart: TChart
Left = 0
Top = 62
Width = 897
Height = 677
Gradient.Balance = 75
Gradient.Direction = gdLeftRight
Gradient.EndColor = 16777088
Gradient.Visible = True
Legend.CurrentPage = False
Title.Text.Strings = (
'TChart')
BottomAxis.Increment = 0.5
BottomAxis.LabelsAngle = 90
BottomAxis.LabelsFont.Height = -13
BottomAxis.LabelsFont.Style = [fsBold]
BottomAxis.LabelsFont.Shadow.HorizSize = 1
BottomAxis.LabelsFont.Shadow.VertSize = 1
BottomAxis.MinorTickCount = 0
BottomAxis.MinorTickLength = 0
LeftAxis.AxisValuesFormat = '#,#00.###'
LeftAxis.LabelsFont.Color = clTeal
LeftAxis.LabelsFont.Height = -15
LeftAxis.LabelsFont.Style = [fsBold]
LeftAxis.MinorTickCount = 0
LeftAxis.MinorTickLength = 0
LeftAxis.Title.Font.Height = -12
LeftAxis.Title.Font.Style = [fsBold]
ScaleLastPage = False
View3D = False
Align = alClient
TabOrder = 0
PrintMargins = (
15
10
15
10)
object Series1: TColorGridSeries
CenteredPoints = True
Marks.ArrowLength = 0
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Length = 0
Marks.Font.Color = clTeal
Marks.Font.Style = [fsBold]
Marks.Font.Shadow.Color = 8454143
Marks.Font.Shadow.HorizSize = 1
Marks.Font.Shadow.VertSize = 1
Marks.Transparent = True
Marks.Visible = True
SeriesColor = clRed
ShowInLegend = False
Pen.Color = clWhite
XValues.DateTime = True
XValues.Name = 'X'
YValues.Name = 'Y'
ZValues.Name = 'Z'
Data = {}
end
I have a problem with PAGING ; on the X axis, I can have perhaps a hundred of days, so I want to be able to draw twenty days on each page. When I use paging, I get a near correct first page (the first and the last columns are not aligned), then the next pages show a variable number of columns.
Can you help ?
Thanks,
Joel
I choosed to use the TColorGridSeries graphic with these settings :
- X axis shows dates
- Z axis shows hour of the day (0-23)
- Y axis shows the number of events
I used the following code to test :
var
i,j : Integer;
time : TDateTime;
Begin
Series1.Clear;
time:=now;
for i:=0 to 23 Do
Begin
for j:=0 to 30 Do
Begin
Series1.AddXYZ(trunc(time+j),i,i);
End;
End;
end;
The Teechart object is defined as :
object Chart: TChart
Left = 0
Top = 62
Width = 897
Height = 677
Gradient.Balance = 75
Gradient.Direction = gdLeftRight
Gradient.EndColor = 16777088
Gradient.Visible = True
Legend.CurrentPage = False
Title.Text.Strings = (
'TChart')
BottomAxis.Increment = 0.5
BottomAxis.LabelsAngle = 90
BottomAxis.LabelsFont.Height = -13
BottomAxis.LabelsFont.Style = [fsBold]
BottomAxis.LabelsFont.Shadow.HorizSize = 1
BottomAxis.LabelsFont.Shadow.VertSize = 1
BottomAxis.MinorTickCount = 0
BottomAxis.MinorTickLength = 0
LeftAxis.AxisValuesFormat = '#,#00.###'
LeftAxis.LabelsFont.Color = clTeal
LeftAxis.LabelsFont.Height = -15
LeftAxis.LabelsFont.Style = [fsBold]
LeftAxis.MinorTickCount = 0
LeftAxis.MinorTickLength = 0
LeftAxis.Title.Font.Height = -12
LeftAxis.Title.Font.Style = [fsBold]
ScaleLastPage = False
View3D = False
Align = alClient
TabOrder = 0
PrintMargins = (
15
10
15
10)
object Series1: TColorGridSeries
CenteredPoints = True
Marks.ArrowLength = 0
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Length = 0
Marks.Font.Color = clTeal
Marks.Font.Style = [fsBold]
Marks.Font.Shadow.Color = 8454143
Marks.Font.Shadow.HorizSize = 1
Marks.Font.Shadow.VertSize = 1
Marks.Transparent = True
Marks.Visible = True
SeriesColor = clRed
ShowInLegend = False
Pen.Color = clWhite
XValues.DateTime = True
XValues.Name = 'X'
YValues.Name = 'Y'
ZValues.Name = 'Z'
Data = {}
end
I have a problem with PAGING ; on the X axis, I can have perhaps a hundred of days, so I want to be able to draw twenty days on each page. When I use paging, I get a near correct first page (the first and the last columns are not aligned), then the next pages show a variable number of columns.
Can you help ?
Thanks,
Joel