Relative placement of marks
Posted: Sat Jan 05, 2013 7:49 pm
Hi,
I have a chart with several Lines series. For each point on the series I wish to display a Mark, at a position relative (in pixels) to the point. After reading some suggestions on this forum, I have come to the following code which I place in the OnAfterDraw event.
Using this code, the Marks do appear but remain "static" when panning or zooming the chart (i.e. don't move with the line series). Any suggestions to what I am doing wrong?
Thanks,
Mark
I have a chart with several Lines series. For each point on the series I wish to display a Mark, at a position relative (in pixels) to the point. After reading some suggestions on this forum, I have come to the following code which I place in the OnAfterDraw event.
Code: Select all
procedure TdlgSD_WellPlot.OnAfterDraw(Sender: TObject);
var
APosition: TSeriesMarkPosition;
ii, jj: Integer;
begin
inherited;
APosition := TSeriesMarkPosition.Create;
try
for ii := 0 to (Sender as TChart).SeriesList.Count - 1 do
begin
for jj := 0 to (Sender as TChart).Series[ii].ValuesList.Count - 1 do
begin
APosition.Custom := true;
APosition.LeftTop.x := (Sender as TChart).Series[ii].CalcXPos(jj);
APosition.LeftTop.y := (Sender as TChart).Series[ii].CalcYPos(jj);
(Sender as TChart).Series[ii].Marks.Positions[jj] := APosition;
end;
end;
finally
APosition.Free;
end;
end;
Thanks,
Mark