mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 15:56:10 +02:00
TAChart: Replace hard-coded rgb colors by system colors to make charts compatible with dark mode.
git-svn-id: trunk@64662 -
This commit is contained in:
parent
26cd6c23a9
commit
d58c41bcad
@ -192,7 +192,7 @@ type
|
||||
property Grid: TChartAxisGridPen read FGrid write SetGrid;
|
||||
property Intervals: TChartAxisIntervalParams
|
||||
read GetIntervals write SetIntervals;
|
||||
property TickColor: TColor read FTickColor write SetTickColor default clBlack;
|
||||
property TickColor: TColor read FTickColor write SetTickColor default clDefault;
|
||||
property TickInnerLength: Integer
|
||||
read FTickInnerLength write SetTickInnerLength default 0;
|
||||
property TickLength: Integer read FTickLength write SetTickLength;
|
||||
@ -243,6 +243,7 @@ type
|
||||
AFixedCoord: Integer; AMark: Double; const AText: String);
|
||||
procedure EndDrawing; virtual; abstract;
|
||||
procedure GetClipRange(out AMin, AMax: Integer); virtual; abstract;
|
||||
function GetDefaultPenColor: TColor;
|
||||
function GraphToImage(AGraph: Double): Integer; virtual; abstract;
|
||||
end;
|
||||
|
||||
@ -349,17 +350,27 @@ begin
|
||||
|
||||
if FAxis.Grid.Visible then begin
|
||||
FDrawer.Pen := FAxis.Grid;
|
||||
if (FAxis.Grid.Color = clDefault) then
|
||||
FDrawer.SetPenColor(GetDefaultPenColor);
|
||||
FDrawer.SetBrushParams(bsClear, clTAColor);
|
||||
GridLine(coord);
|
||||
FPrevCoord := coord;
|
||||
end;
|
||||
|
||||
if FAxis.Marks.Visible then begin
|
||||
FDrawer.PrepareSimplePen(FAxis.TickColor);
|
||||
if (FAxis.TickColor = clDefault) then
|
||||
FDrawer.PrepareSimplePen(GetDefaultPenColor)
|
||||
else
|
||||
FDrawer.PrepareSimplePen(FAxis.TickColor);
|
||||
DrawLabelAndTick(coord, AFixedCoord, AText);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TAxisDrawHelper.GetDefaultPenColor: TColor;
|
||||
begin
|
||||
Result := TCustomChart(FAxis.Collection.Owner).GetDefaultColor(dctFont);
|
||||
end;
|
||||
|
||||
procedure TAxisDrawHelper.InternalAxisLine(
|
||||
APen: TChartPen; const AStart, AEnd: TPoint; AAngle: Double);
|
||||
var
|
||||
@ -368,6 +379,8 @@ var
|
||||
begin
|
||||
if not APen.Visible and not FAxis.Arrow.Visible then exit;
|
||||
FDrawer.Pen := APen;
|
||||
if (APen.Color = clDefault) then
|
||||
FDrawer.SetPenColor(GetDefaultPenColor);
|
||||
if APen.Visible then
|
||||
LineZ(AStart, AEnd);
|
||||
if FAxis.Arrow.Visible then begin
|
||||
@ -713,7 +726,7 @@ begin
|
||||
FGrid := TChartAxisGridPen.Create;
|
||||
FGrid.OnChange := @StyleChanged;
|
||||
// FMarks must be created in descendants.
|
||||
FTickColor := clBlack;
|
||||
FTickColor := clDefault;
|
||||
FVisible := true;
|
||||
end;
|
||||
|
||||
|
@ -412,7 +412,7 @@ type
|
||||
read FAntialiasingMode write SetAntialiasingMode default amDontCare;
|
||||
property AxisList: TChartAxisList read FAxisList write SetAxisList;
|
||||
property AxisVisible: Boolean read FAxisVisible write SetAxisVisible default true;
|
||||
property BackColor: TColor read FBackColor write SetBackColor default clBtnFace;
|
||||
property BackColor: TColor read FBackColor write SetBackColor default clWindow;
|
||||
property BottomAxis: TChartAxis index calBottom read GetAxisByAlign write SetAxisByAlign stored false;
|
||||
property Depth: TChartDistance read FDepth write SetDepth default 0;
|
||||
property ExpandPercentage: Integer
|
||||
@ -475,7 +475,7 @@ type
|
||||
property Anchors;
|
||||
property BiDiMode;
|
||||
property BorderSpacing;
|
||||
property Color default clBtnFace;
|
||||
property Color default clWindow;
|
||||
property Constraints;
|
||||
property DoubleBuffered;
|
||||
property DragCursor;
|
||||
@ -727,8 +727,8 @@ begin
|
||||
Height := DEFAULT_CHART_HEIGHT;
|
||||
|
||||
FSeries := TChartSeriesList.Create;
|
||||
Color := clBtnFace;
|
||||
FBackColor := clBtnFace;
|
||||
Color := clWindow;
|
||||
FBackColor := clWindow;
|
||||
FIsZoomed := false;
|
||||
FLegend := TChartLegend.Create(Self);
|
||||
|
||||
@ -1030,6 +1030,7 @@ var
|
||||
defaultDrawing: Boolean = true;
|
||||
ic: IChartTCanvasDrawer;
|
||||
scaled_depth: Integer;
|
||||
clr: TColor;
|
||||
begin
|
||||
if Assigned(OnBeforeCustomDrawBackWall) then
|
||||
OnBeforeCustomDrawBackWall(self, ADrawer, FClipRect, defaultDrawing)
|
||||
@ -1040,10 +1041,18 @@ begin
|
||||
if defaultDrawing then
|
||||
with ADrawer do begin
|
||||
if FFrame.Visible then
|
||||
Pen := FFrame
|
||||
begin
|
||||
Pen := FFrame;
|
||||
if FFrame.Color = clDefault then
|
||||
SetPenColor(GetDefaultColor(dctFont));
|
||||
end
|
||||
else
|
||||
SetPenParams(psClear, clTAColor);
|
||||
SetBrushParams(bsSolid, BackColor);
|
||||
if BackColor = clDefault then
|
||||
clr := GetDefaultColor(dctBrush)
|
||||
else
|
||||
clr := BackColor;
|
||||
SetBrushParams(bsSolid, clr);
|
||||
with FClipRect do
|
||||
Rectangle(Left, Top, Right + 1, Bottom + 1);
|
||||
end;
|
||||
|
@ -593,7 +593,7 @@ begin
|
||||
InitHelper(FBrush, TBrush);
|
||||
FBrush.Color := FOwner.Color;
|
||||
InitHelper(FFont, TFont);
|
||||
FFont.Color := clBlue;
|
||||
FFont.Color := clDefault;
|
||||
InitHelper(FFrame, TChartTitleFramePen);
|
||||
FMargin := DEF_MARGIN;
|
||||
FText := TStringList.Create;
|
||||
|
@ -58,6 +58,7 @@ type
|
||||
procedure Assign(ASource: TPersistent); override;
|
||||
function EffVisible: Boolean; inline;
|
||||
published
|
||||
property Color default clDefault;
|
||||
property Visible: Boolean read FVisible write SetVisible default true;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user