TAChart: Use Legend.Format instead of Title to display the fitting formula in TFitSeries legend

git-svn-id: trunk@34011 -
This commit is contained in:
ask 2011-12-07 00:52:40 +00:00
parent 12eb85016b
commit c87fc2a9cf
2 changed files with 5 additions and 16 deletions

View File

@ -55,7 +55,7 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="10"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
@ -67,10 +67,6 @@
</SyntaxOptions>
</Parsing>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@ -32,7 +32,6 @@ const
DEF_SPLINE_STEP = 4;
DEF_FIT_STEP = 4;
DEF_FIT_PARAM_COUNT = 3;
DEF_FIT_TITLE = '%s';
DEF_COLORMAP_STEP = 4;
type
@ -232,7 +231,6 @@ type
strict protected
procedure CalcXRange(out AXMin, AXMax: Double);
procedure Transform(AX, AY: Double; out ANewX, ANewY: Extended);
function TitleIsStored: Boolean; override;
protected
procedure AfterAdd; override;
procedure GetLegendItems(AItems: TChartLegendItems); override;
@ -1130,7 +1128,6 @@ begin
FPen := TChartPen.Create;
FPen.OnChange := @StyleChanged;
FStep := DEF_FIT_STEP;
Title := DEF_FIT_TITLE;
ParamCount := DEF_FIT_PARAM_COUNT; // Parabolic fit as default.
end;
@ -1225,9 +1222,10 @@ procedure TFitSeries.GetLegendItems(AItems: TChartLegendItems);
var
t: String;
begin
t := Title;
if Pos(DEF_FIT_TITLE, t) > 0 then
t := Format(t, [GetFitEquationString('%f')]);
if Legend.Format = '' then
t := Title
else
t := Format(Legend.Format, [Title, Index, GetFitEquationString('%f')]);
AItems.Add(TLegendItemLine.Create(Pen, t));
end;
@ -1338,11 +1336,6 @@ begin
ExecFit;
end;
function TFitSeries.TitleIsStored: Boolean;
begin
Result := Title <> DEF_FIT_TITLE;
end;
procedure TFitSeries.Transform(AX, AY: Double; out ANewX, ANewY: Extended);
begin
// The exponential and power fitting equations can be transformed to a