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