TAChart: Avoid painting of gaps in non-solid series using the brush color when ChartStyles are active.

git-svn-id: trunk@62094 -
This commit is contained in:
wp 2019-10-20 11:07:40 +00:00
parent 753c843f12
commit 834b592281
4 changed files with 16 additions and 10 deletions

View File

@ -1109,7 +1109,8 @@ var
ADrawer.SetBrushParams(bsClear, clTAColor);
ADrawer.Pen := Pen;
if Styles <> nil then
Styles.Apply(ADrawer, AStyleIndex);
Styles.Apply(ADrawer, AStyleIndex, true);
// "true" avoids painting the gaps of non-solid lines in brush color
splineStart := 0;
splineEnd := -2;
while NextNumberSeq(FGraphPoints, splineStart, splineEnd) do begin

View File

@ -1219,15 +1219,17 @@ var
ADrawer.Brush := FBrush;
if Styles <> nil then
Styles.Apply(ADrawer, AYIndex);
if fill then begin
pts[cnt] := originPt;
ADrawer.SetPenParams(psClear, clBlack);
ADrawer.Polygon(pts, 0, cnt + 1);
end;
ADrawer.Pen := LinePen;
ADrawer.SetBrushParams(bsClear, clTAColor);
if Styles <> nil then
Styles.Apply(ADrawer, AYIndex);
Styles.Apply(ADrawer, AYIndex, true);
// "true" avoids painting the gaps of non-solid lines in the brush color
ADrawer.PolyLine(pts, 0, cnt);
end;

View File

@ -614,7 +614,8 @@ var
ADrawer.SetBrushParams(bsClear, clTAColor);
ADrawer.Pen := LinePen;
if Styles <> nil then
Styles.Apply(ADrawer, AIndex);
Styles.Apply(ADrawer, AIndex, true);
// "true" avoids painting of spaces in non-solid lines in brush color
if Depth = 0 then
for i := 0 to High(breaks) - 1 do
ADrawer.Polyline(points, breaks[i], breaks[i + 1] - breaks[i])

View File

@ -45,7 +45,7 @@ type
constructor Create(ACollection: TCollection); override;
destructor Destroy; override;
public
procedure Apply(ADrawer: IChartDrawer);
procedure Apply(ADrawer: IChartDrawer; IgnoreBrush: Boolean = false);
procedure Assign(Source: TPersistent); override;
published
property Brush: TBrush read FBrush write SetBrush;
@ -94,7 +94,8 @@ type
destructor Destroy; override;
public
function Add: TChartStyle;
procedure Apply(ADrawer: IChartDrawer; AIndex: Cardinal); overload;
procedure Apply(ADrawer: IChartDrawer; AIndex: Cardinal;
IgnoreBrush: Boolean = false); overload;
function StyleByIndex(AIndex: Cardinal): TChartStyle;
property Broadcaster: TBroadcaster read FBroadcaster;
published
@ -119,9 +120,9 @@ end;
{ TChartStyle }
procedure TChartStyle.Apply(ADrawer: IChartDrawer);
procedure TChartStyle.Apply(ADrawer: IChartDrawer; IgnoreBrush: Boolean = false);
begin
if UseBrush then
if UseBrush and not IgnoreBrush then
ADrawer.Brush := Brush;
if UseFont then
ADrawer.Font := Font;
@ -262,13 +263,14 @@ begin
Result := TChartStyle(FStyles.Add);
end;
procedure TChartStyles.Apply(ADrawer: IChartDrawer; AIndex: Cardinal);
procedure TChartStyles.Apply(ADrawer: IChartDrawer; AIndex: Cardinal;
IgnoreBrush: Boolean = false);
var
style: TChartStyle;
begin
style := StyleByIndex(AIndex);
if style <> nil then
style.Apply(ADrawer);
style.Apply(ADrawer, IgnoreBrush);
end;
constructor TChartStyles.Create(AOwner: TComponent);