TAChart: Add TChartAxis.Marks property, use it to control marks font

git-svn-id: trunk@24130 -
This commit is contained in:
ask 2010-03-21 05:40:05 +00:00
parent 6b4119e9ac
commit 289d06d85d

View File

@ -118,6 +118,7 @@ type
FAlignment: TChartAxisAlignment; FAlignment: TChartAxisAlignment;
FGrid: TChartAxisPen; FGrid: TChartAxisPen;
FInverted: Boolean; FInverted: Boolean;
FMarks: TChartMarks;
FOnMarkToText: TChartAxisMarkToTextEvent; FOnMarkToText: TChartAxisMarkToTextEvent;
FTickColor: TColor; FTickColor: TColor;
FTickLength: Integer; FTickLength: Integer;
@ -128,6 +129,7 @@ type
procedure SetAlignment(AValue: TChartAxisAlignment); procedure SetAlignment(AValue: TChartAxisAlignment);
procedure SetGrid(AValue: TChartAxisPen); procedure SetGrid(AValue: TChartAxisPen);
procedure SetInverted(AValue: Boolean); procedure SetInverted(AValue: Boolean);
procedure SetMarks(const AValue: TChartMarks);
procedure SetOnMarkToText(const AValue: TChartAxisMarkToTextEvent); procedure SetOnMarkToText(const AValue: TChartAxisMarkToTextEvent);
procedure SetTickColor(AValue: TColor); procedure SetTickColor(AValue: TColor);
procedure SetTickLength(AValue: Integer); procedure SetTickLength(AValue: Integer);
@ -168,6 +170,7 @@ type
read FTransformation write SetTransformation; read FTransformation write SetTransformation;
property Visible: Boolean read FVisible write SetVisible default true; property Visible: Boolean read FVisible write SetVisible default true;
published published
property Marks: TChartMarks read FMarks write SetMarks;
property OnMarkToText: TChartAxisMarkToTextEvent property OnMarkToText: TChartAxisMarkToTextEvent
read FOnMarkToText write SetOnMarkToText; read FOnMarkToText write SetOnMarkToText;
end; end;
@ -277,6 +280,7 @@ begin
FGrid := TChartAxisPen.Create; FGrid := TChartAxisPen.Create;
FGrid.OnChange := @StyleChanged; FGrid.OnChange := @StyleChanged;
FGrid.Style := psDot; FGrid.Style := psDot;
FMarks := TChartMarks.Create(ACollection.Owner as TCustomChart);
FTickColor := clBlack; FTickColor := clBlack;
FTickLength := DEF_TICK_LENGTH; FTickLength := DEF_TICK_LENGTH;
FTitle := TChartAxisTitle.Create(ACollection.Owner as TCustomChart); FTitle := TChartAxisTitle.Create(ACollection.Owner as TCustomChart);
@ -289,6 +293,7 @@ destructor TChartAxis.Destroy;
begin begin
FTransformation.Free; FTransformation.Free;
FTitle.Free; FTitle.Free;
FMarks.Free;
FGrid.Free; FGrid.Free;
inherited; inherited;
end; end;
@ -378,6 +383,7 @@ procedure TChartAxis.Draw(
begin begin
if not Visible then exit; if not Visible then exit;
ACanvas.Font := Marks.LabelFont;
if IsVertical then if IsVertical then
DoDraw(AExtent.a.Y, AExtent.b.Y) DoDraw(AExtent.a.Y, AExtent.b.Y)
else else
@ -517,6 +523,7 @@ begin
FSize := 0; FSize := 0;
FTitleSize := 0; FTitleSize := 0;
if not Visible then exit; if not Visible then exit;
ACanvas.Font := Marks.LabelFont;
digitSize := ACanvas.TextExtent(SOME_DIGIT); digitSize := ACanvas.TextExtent(SOME_DIGIT);
if IsVertical then if IsVertical then
CalcVertSize CalcVertSize
@ -545,6 +552,13 @@ begin
StyleChanged(Self); StyleChanged(Self);
end; end;
procedure TChartAxis.SetMarks(const AValue: TChartMarks);
begin
if FMarks = AValue then exit;
FMarks := AValue;
StyleChanged(Self);
end;
procedure TChartAxis.SetOnMarkToText(const AValue: TChartAxisMarkToTextEvent); procedure TChartAxis.SetOnMarkToText(const AValue: TChartAxisMarkToTextEvent);
begin begin
if FOnMarkToText = AValue then exit; if FOnMarkToText = AValue then exit;