diff --git a/components/tachart/demo/legend/legenddemo.lpi b/components/tachart/demo/legend/legenddemo.lpi index 2ef70a3af2..208a0bfeba 100644 --- a/components/tachart/demo/legend/legenddemo.lpi +++ b/components/tachart/demo/legend/legenddemo.lpi @@ -1,20 +1,19 @@ + - - <ResourceType Value="res"/> </General> <VersionInfo> - <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> + <StringTable ProductVersion=""/> </VersionInfo> <PublishOptions> <Version Value="2"/> @@ -56,7 +55,7 @@ <Version Value="9"/> <PathDelim Value="\"/> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)\"/> + <IncludeFiles Value="$(ProjOutDir)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> </SearchPaths> <Parsing> diff --git a/components/tachart/talegend.pas b/components/tachart/talegend.pas index cf875f1b54..6320e4d562 100644 --- a/components/tachart/talegend.pas +++ b/components/tachart/talegend.pas @@ -194,12 +194,15 @@ end; procedure TLegendItemLinePointer.Draw(ACanvas: TCanvas; const ARect: TRect); var - c: TPoint; + c, sz: TPoint; begin inherited Draw(ACanvas, ARect); if FPointer = nil then exit; c := CenterPoint(ARect); - FPointer.Draw(ACanvas, c, clTAColor); + // Max width slightly narrower then ARect to leave place for the line. + sz.X := Min(FPointer.HorizSize, (ARect.Right - ARect.Left) div 3); + sz.Y := Min(FPointer.VertSize, (ARect.Bottom - ARect.Top) div 2); + FPointer.DrawSize(ACanvas, c, sz, clTAColor); end; { TLegendItemBrushRect } diff --git a/components/tachart/tatypes.pas b/components/tachart/tatypes.pas index af5b280da9..474793c618 100644 --- a/components/tachart/tatypes.pas +++ b/components/tachart/tatypes.pas @@ -220,6 +220,8 @@ type procedure Assign(Source: TPersistent); override; procedure Draw(ACanvas: TCanvas; ACenter: TPoint; AColor: TColor); + procedure DrawSize( + ACanvas: TCanvas; ACenter, ASize: TPoint; AColor: TColor); published property Brush: TBrush read FBrush write SetBrush; property HorizSize: Integer read FHorizSize write SetHorizSize default DEF_POINTER_SIZE; @@ -666,6 +668,12 @@ begin end; procedure TSeriesPointer.Draw(ACanvas: TCanvas; ACenter: TPoint; AColor: TColor); +begin + DrawSize(ACanvas, ACenter, Point(HorizSize, VertSize), AColor); +end; + +procedure TSeriesPointer.DrawSize( + ACanvas: TCanvas; ACenter, ASize: TPoint; AColor: TColor); function PointByIndex(AIndex: Char): TPoint; // 7--8--9 @@ -676,8 +684,8 @@ procedure TSeriesPointer.Draw(ACanvas: TCanvas; ACenter: TPoint; AColor: TColor) H: array ['1'..'9'] of -1..1 = (-1, 0, 1, -1, 0, 1, -1, 0, 1); begin Result := ACenter; - Result.X += H[AIndex] * HorizSize; - Result.Y += V[AIndex] * VertSize; + Result.X += H[AIndex] * ASize.X; + Result.Y += V[AIndex] * ASize.Y; end; procedure DrawByString(const AStr: String); @@ -718,8 +726,8 @@ begin if FStyle = psCircle then ACanvas.Ellipse( - ACenter.X - HorizSize, ACenter.Y - VertSize, - ACenter.X + HorizSize, ACenter.Y + VertSize) + ACenter.X - ASize.X, ACenter.Y - ASize.Y, + ACenter.X + ASize.X, ACenter.Y + ASize.Y) else DrawByString(DRAW_STRINGS[FStyle] + ' '); end;