mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 21:01:14 +02:00
TAChart: Introduce TFuncSeries.Step to control drawing granularity.
git-svn-id: trunk@19298 -
This commit is contained in:
parent
5c796207d7
commit
51f0ad8fc8
@ -42,6 +42,7 @@ object Form1: TForm1
|
||||
Extent.UseYMax = True
|
||||
Pen.Color = clOlive
|
||||
Pen.Width = 2
|
||||
Step = 4
|
||||
Title = 'Sin(x)'
|
||||
end
|
||||
object Chart1XAxis: TLine
|
||||
|
@ -16,8 +16,8 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
||||
+'t.YMin'#5#0#0#0#0#0#0#0#128#255#191#11'Extent.XMax'#5#0#248'(\'#143#194#245
|
||||
+#200#1'@'#11'Extent.YMax'#5#0#0#0#0#0#0#0#128#255'?'#14'Extent.UseXMin'#9#14
|
||||
+'Extent.UseYMin'#9#14'Extent.UseXMax'#9#14'Extent.UseYMax'#9#9'Pen.Color'#7#7
|
||||
+'clOlive'#9'Pen.Width'#2#2#5'Title'#6#6'Sin(x)'#0#0#5'TLine'#11'Chart1XAxis'
|
||||
+#12'ShowInLegend'#8#11'SeriesColor'#7#7'clBlack'#0#0#5'TLine'#11'Chart1YAxis'
|
||||
+#12'ShowInLegend'#8#9'LineStyle'#7#10'lsVertical'#11'SeriesColor'#7#7'clBlac'
|
||||
+'k'#0#0#0#0
|
||||
+'clOlive'#9'Pen.Width'#2#2#4'Step'#2#4#5'Title'#6#6'Sin(x)'#0#0#5'TLine'#11
|
||||
+'Chart1XAxis'#12'ShowInLegend'#8#11'SeriesColor'#7#7'clBlack'#0#0#5'TLine'#11
|
||||
+'Chart1YAxis'#12'ShowInLegend'#8#9'LineStyle'#7#10'lsVertical'#11'SeriesColo'
|
||||
+'r'#7#7'clBlack'#0#0#0#0
|
||||
]);
|
||||
|
@ -291,6 +291,8 @@ type
|
||||
|
||||
TFuncCalculateEvent = procedure (const AX: Double; out AY: Double) of object;
|
||||
|
||||
TFuncSeriesStep = 1..MaxInt;
|
||||
|
||||
{ TFuncSeries }
|
||||
|
||||
TFuncSeries = class(TBasicChartSeries)
|
||||
@ -298,10 +300,12 @@ type
|
||||
FExtent: TChartExtent;
|
||||
FOnCalculate: TFuncCalculateEvent;
|
||||
FPen: TChartPen;
|
||||
FStep: TFuncSeriesStep;
|
||||
|
||||
procedure SetExtent(const AValue: TChartExtent);
|
||||
procedure SetOnCalculate(const AValue: TFuncCalculateEvent);
|
||||
procedure SetPen(const AValue: TChartPen);
|
||||
procedure SetStep(AValue: TFuncSeriesStep);
|
||||
protected
|
||||
procedure DrawLegend(ACanvas: TCanvas; const ARect: TRect); override;
|
||||
function GetLegendCount: Integer; override;
|
||||
@ -327,6 +331,7 @@ type
|
||||
property Pen: TChartPen read FPen write SetPen;
|
||||
property OnCalculate: TFuncCalculateEvent read FOnCalculate write SetOnCalculate;
|
||||
property ShowInLegend;
|
||||
property Step: TFuncSeriesStep read FStep write SetStep default 2;
|
||||
property Title;
|
||||
end;
|
||||
|
||||
@ -1538,6 +1543,7 @@ begin
|
||||
FShowInLegend := true;
|
||||
FPen := TChartPen.Create;
|
||||
FPen.OnChange := @StyleChanged;
|
||||
FStep := 2;
|
||||
end;
|
||||
|
||||
destructor TFuncSeries.Destroy;
|
||||
@ -1582,7 +1588,7 @@ begin
|
||||
|
||||
ACanvas.MoveTo(x, CalcY(x));
|
||||
while x < xmax do begin
|
||||
Inc(x, 2);
|
||||
Inc(x, FStep);
|
||||
ACanvas.LineTo(x, CalcY(x));
|
||||
end;
|
||||
end;
|
||||
@ -1659,6 +1665,13 @@ begin
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
||||
procedure TFuncSeries.SetStep(AValue: TFuncSeriesStep);
|
||||
begin
|
||||
if FStep = AValue then exit;
|
||||
FStep := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
||||
procedure TFuncSeries.StyleChanged(Sender: TObject);
|
||||
begin
|
||||
UpdateParentChart;
|
||||
|
Loading…
Reference in New Issue
Block a user