Chart visible in View
This commit is contained in:
+18
-11
@@ -64,7 +64,6 @@ type
|
||||
FSymbolsValid: TFMXValidationState;
|
||||
FStreamUpdate: TFMXValidationState;
|
||||
FSymbols: TFuture<TArray<String>>;
|
||||
FStream: IDataStream<TAskBidItem>;
|
||||
FRandom: TList<TRndItem>;
|
||||
public
|
||||
{ Public declarations }
|
||||
@@ -122,21 +121,29 @@ end;
|
||||
|
||||
procedure TForm1.LoadButtonClick(Sender: TObject);
|
||||
begin
|
||||
FStream := FServer.CreateStream(FSymbols.WaitFor[SymbolsComboBox.ItemIndex]);
|
||||
var Stream := FServer.CreateStream(FSymbols.WaitFor[SymbolsComboBox.ItemIndex]);
|
||||
var Data := TDataStreamProvider.Create<TAskBidItem>(3000, 1000, Stream);
|
||||
var Idx := 0;
|
||||
FStreamUpdate :=
|
||||
TFMXValidationState.Create(
|
||||
Path1,
|
||||
FStream.HasData,
|
||||
Data.Changed,
|
||||
procedure
|
||||
var
|
||||
Data: array[0..200] of TDataPoint<TAskBidItem>;
|
||||
begin
|
||||
var cnt := FStream.GetChunk(Data);
|
||||
if cnt = 0 then
|
||||
exit;
|
||||
var Prices := Data.Value;
|
||||
|
||||
for var i := 0 to cnt - 1 do
|
||||
Path1.Data.LineTo(PointF(Path1.Data.Count, Data[i].Data.Ask));
|
||||
if Prices.Count > 0 then
|
||||
begin
|
||||
Path1.BeginUpdate;
|
||||
try
|
||||
Path1.Data.Clear;
|
||||
Path1.Data.MoveTo(PointF(Path1.Width-1, Prices[0].Data.Ask));
|
||||
for var i := 1 to Prices.Count - 1 do
|
||||
Path1.Data.LineTo(PointF(Path1.Width-i-1, Prices[i].Data.Ask));
|
||||
finally
|
||||
Path1.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
);
|
||||
end;
|
||||
@@ -162,7 +169,7 @@ begin
|
||||
begin
|
||||
TFMXValidationState.Create(
|
||||
FRandom[idx].Labl,
|
||||
FRandom[idx].Stream.HasData,
|
||||
FRandom[idx].Data.Changed,
|
||||
procedure
|
||||
begin
|
||||
var data := FRandom[idx].Data.Value;
|
||||
|
||||
@@ -26,7 +26,7 @@ type
|
||||
strict private
|
||||
// Head of the linked list. The pointer value itself is repurposed for a spinlock.
|
||||
// Bit 0 of the address stores the lock state (0 = locked, 1 = unlocked).
|
||||
FList: PItem;
|
||||
[volatile] FList: PItem;
|
||||
|
||||
// Allocates memory for a new TItem.
|
||||
class function AllocItem: PItem; static; inline;
|
||||
|
||||
Reference in New Issue
Block a user