First it appears that this fails on Linux (Raspberry Pi) with v0.9.30.4-6 but not on Windows with v1.0.14.
It appears that the range goes astray when adding points dynamically on the Origin range.
unit Main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TAGraph, TASources, TASeries, Forms, Controls,
Graphics, Dialogs, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
CalculatedChartSource1: TCalculatedChartSource;
Chart1: TChart;
Chart1LineSeries1: TLineSeries;
Chart1LineSeries2: TLineSeries;
ListChartSource1: TListChartSource;
Timer1: TTimer;
procedure FormActivate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
i: integer;
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormActivate(Sender: TObject);
begin
for i:= 1 to 40 do
ListChartSource1.Add(Double(i),Double(Random(100)/20+10),'Dummy', clBlack);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
i+=1;
ListChartSource1.Add(Double(i),Double(Random(100)/20+10),'Dummy', clBlack);
if i>60 then
Timer1.Enabled:=False;
end;
end.
The form is:
object Form1: TForm1
Left = 270
Height = 446
Top = 133
Width = 534
Caption = 'Form1'
ClientHeight = 446
ClientWidth = 534
OnActivate = FormActivate
LCLVersion = '0.9.30.4'
object Chart1: TChart
Left = 0
Height = 446
Top = 0
Width = 534
AxisList = <
item
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
end>
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
'TAChart'
)
Align = alClient
ParentColor = False
object Chart1LineSeries1: TLineSeries
LinePen.Width = 2
Source = ListChartSource1
end
object Chart1LineSeries2: TLineSeries
LinePen.Color = clYellow
LinePen.Width = 4
Source = CalculatedChartSource1
end
end
object ListChartSource1: TListChartSource
left = 80
top = 53
end
object CalculatedChartSource1: TCalculatedChartSource
AccumulationMethod = camAverage
AccumulationRange = 10
Origin = ListChartSource1
left = 197
top = 85
end
object Timer1: TTimer
OnTimer = Timer1Timer
left = 195
top = 177
end
end