Is it possible/How do I reposition a mark horizontally? In a bar chart, for example...???
regards,
Milton Lapido
Can marks be moved horizontally?
Hi, Milton.
Yes, you can fully customize the position of each series mark. For example, the following code centers all series marks vertically and left aligns them horizontally:
The only thing you should be aware of is that mark positions are created ONLY after the chart is drawn for the first time. In case you have to change mark positions before chart is drawn for the first time, you can either create mark positions by hand or force chart draw by calling chart Draw method.
Yes, you can fully customize the position of each series mark. For example, the following code centers all series marks vertically and left aligns them horizontally:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(5);
end;
procedure TForm1.AlignMarks;
var i: Integer;
begin
// no need for arrows
Series1.Marks.Arrow.Visible := False;
for i := 0 to Series1.Count -1 do
With Series1.Marks.Positions.Position[i] do
begin
Custom := True;
LeftTop.Y := Series1.CalcYPosValue(Series1.YValues[i]*0.5);
LeftTop.X := Series1.CalcXPos(i) - Series1.Marks.Width;
end;
Chart1.Repaint;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
AlignMarks;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com