I have a TFastLineSeries that, for every 50th value entered, should display a single character at the bottom of the chart (but above the x-axis). I've got everything working as I intended, except for a small drawing issue. I'm not sure if it is "as designed" or an issue I've overlooked.
The way I've implemented is as follows:
From a timer event I call this:
Code: Select all
procedure TForm1.RealTimeAdd(Series: TChartSeries);
var
XValue,YValue : Double;
aIndex: integer;
begin
if Series.Count = 0 then begin // First random point
YValue := Random(50);
XValue := now;
end else begin
// Next point
YValue := Series.YValues.Last + Random(10) - 4.5;
YValue := Max(Min(YValue, 100), 0);
XValue := now;
end;
// Add new point
aIndex := Series.AddXY(XValue, YValue);
//For every 50th value add a mark
if Series.Count mod 50 = 0 then begin
Series.Marks.Item[aIndex].Text.Text := 'A'; //Just show an 'A' for now
end;
end;
Code: Select all
procedure TForm1.chMainAfterDraw(Sender: TObject);
var
APosition: TSeriesMarkPosition;
i: Integer;
begin
inherited;
APosition := TSeriesMarkPosition.Create;
try
begin
for i := 0 to Series1.Count - 1 do begin
APosition.Custom := true;
APosition.LeftTop.x := Series1.CalcXPos(i);
APosition.LeftTop.y := Series1.CalcYPosValue(8); //Static
Series1.Marks.Positions[i] := APosition;
end;
end;
finally
APosition.Free;
end;
end;
Please see the small dot right above the 'A'. Why is that there, and what to do to get rid of it?
[img] [/img]
Thanks in advance.
Regards,
Leo