TAChart: Fix TChartSeries.SetColor to notify all listeners and require ListSource. Add TListChartSource.SetColor

git-svn-id: trunk@38733 -
This commit is contained in:
ask 2012-09-18 11:54:34 +00:00
parent 5c77b8e843
commit 1789905e3c
2 changed files with 14 additions and 6 deletions

View File

@ -175,7 +175,7 @@ type
function GetYMax: Double;
function GetYMin: Double;
function GetYValue(AIndex: Integer): Double;
procedure SetColor(AIndex: Integer; AColor: TColor);
procedure SetColor(AIndex: Integer; AColor: TColor); inline;
procedure SetText(AIndex: Integer; AValue: String); inline;
procedure SetXValue(AIndex: Integer; AValue: Double); inline;
procedure SetYValue(AIndex: Integer; AValue: Double); inline;
@ -814,11 +814,7 @@ end;
procedure TChartSeries.SetColor(AIndex: Integer; AColor: TColor);
begin
with Source[AIndex]^ do begin
if Color = AColor then exit;
Color := AColor;
UpdateParentChart;
end;
ListSource.SetColor(AIndex, AColor);
end;
procedure TChartSeries.SetMarks(AValue: TChartMarks);

View File

@ -61,10 +61,13 @@ type
procedure CopyFrom(ASource: TCustomChartSource);
procedure Delete(AIndex: Integer);
function IsSorted: Boolean; override;
procedure SetColor(AIndex: Integer; AColor: TChartColor);
procedure SetText(AIndex: Integer; AValue: String);
function SetXValue(AIndex: Integer; AValue: Double): Integer;
procedure SetYList(AIndex: Integer; const AYList: array of Double);
procedure SetYValue(AIndex: Integer; AValue: Double);
procedure Sort;
published
property DataPoints: TStrings read FDataPoints write SetDataPoints;
@ -500,6 +503,15 @@ begin
SetLength(Result^.YList, Max(YCount - 1, 0));
end;
procedure TListChartSource.SetColor(AIndex: Integer; AColor: TChartColor);
begin
with Item[AIndex]^ do begin
if Color = AColor then exit;
Color := AColor;
end;
Notify;
end;
procedure TListChartSource.SetDataPoints(AValue: TStrings);
begin
if FDataPoints = AValue then exit;