Hi folks,
is it possible to show the grid lines of the bottom,left, ... axis and to hide the labels of the axis at the same time?
-> I have 2 different charts, one chart adjected on top of the other and there should be only one bottom axis visible (the one of the lower chart). Any ideas?
Tia and greetings from Obelix
TeeChart Labels and Grids
Hi,
Yes, you can do this using the following code :is it possible to show the grid lines of the bottom,left, ... axis and to hide the labels of the axis at the same time?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
series1.FillSampleValues(10);
chart1.BottomAxis.MinorTicks.visible := False;
chart1.BottomAxis.Ticks.Visible:= False;
end;
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
if Sender = Chart1.BottomAxis then
Labeltext := ' ';
end;
end.
Pep Jorge
http://support.steema.com
http://support.steema.com
Changing labels at runtime
Thanks, it's working very good,
but is it also possible to change the color/font and text
for some of the labels?
Assume you have a gantt series within your chart and you want to display the labels of some of your gantt items in a special color/font style (ie. saturday and sunday in red, style to bold)... and only when it's possible, to show weeknames instead of the date on the labels.
Any tips and tricks avaiable?
Tia Obelix
BTW: Mouse scrolling only works for me, you placed an enabled TWinControl on the chart
but is it also possible to change the color/font and text
for some of the labels?
Assume you have a gantt series within your chart and you want to display the labels of some of your gantt items in a special color/font style (ie. saturday and sunday in red, style to bold)... and only when it's possible, to show weeknames instead of the date on the labels.
Any tips and tricks avaiable?
Tia Obelix
BTW: Mouse scrolling only works for me, you placed an enabled TWinControl on the chart
Hi.
Yes, sure, it can be done. The feature is demonstrated in TeeChart demo. Especially, check the following example:
"All Features -> Axes -> Labels -> Custom Labels"
Alternatively, you can also use chart OnGetAxisLabel event to customize individual axis label font properties. Here is an example:
Similar code, but with different condition (compare axis label value directly with point labels) could also be used in your case.
Yes, sure, it can be done. The feature is demonstrated in TeeChart demo. Especially, check the following example:
"All Features -> Axes -> Labels -> Custom Labels"
Alternatively, you can also use chart OnGetAxisLabel event to customize individual axis label font properties. Here is an example:
Code: Select all
procedure TAxisLabelsFormat.Chart1GetAxisLabel(Sender: TChartAxis;
Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
var Num : Double;
begin
Num:=StrToFloat(LabelText);
// if value > 300, color it red, otherwise blue
if Sender=Chart1.Axes.Left then
begin
if Num>300 then Sender.LabelsFont.Color:=clRed
else Sender.LabelsFont.Color:=clBlue;
end;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com