Page 1 of 1

Horizontal Line series axis shift with Marks

Posted: Thu Dec 15, 2005 5:56 pm
by 9333098
The Horizontal Line series displays its Marks to the sides of its data points instead of above or below them. With a standard bottom axis, Marks are positioned to the right of the data points (towards the bottom axis maximum). When Marks are visible, the bottom axis maximum value position shifts to the left towards axis minimum to account for the space occupied by the Marks so that the Marks remain within the bounding axis inner region.

When the bottom axis is Inverted, the Marks appear to the left of the data points, as they should now be. However, the bottom axis maximum value position still shifts to the left. Since marks are no longer on the right of the points, this results in a gap within the chart region. It is the bottom axis minimum value position that should shift to the right. Instead, it does not move and the marks end up positioned outside the axis region..

I notice that with marks visible on a non-inverted axis, the bottom axis displacement only shift about half of the mark inside the axis region. Some of it still remains outside the axis.

With a normal non-horizontal line series, the mark's of the maximum data value is positioned so that its bottom edge is at the axis maximum. This leaves the mark test itself outside the axis region. Could instead the left axis maximum position be shifted so that the mark text lies within the axis inner region ?

Also, when the normal line series left axis is inverted, the marks remain above the data point and do not shift below them. This contrasts with the behavior described above for horizontal line series where the the mark position switches to the left of the data point when the axis is inverted. Perhaps this is the desired behavior due to how such series are being viewed ?

This can be observed using the chart editor. D7 with TChart 7.05

Steve

Posted: Fri Dec 16, 2005 9:49 am
by narcis
Hi Steve,
When the bottom axis is Inverted, the Marks appear to the left of the data points, as they should now be. However, the bottom axis maximum value position still shifts to the left. Since marks are no longer on the right of the points, this results in a gap within the chart region. It is the bottom axis minimum value position that should shift to the right. Instead, it does not move and the marks end up positioned outside the axis region..
I'll add this to our wish-list to be reviewed for future releases.
I notice that with marks visible on a non-inverted axis, the bottom axis displacement only shift about half of the mark inside the axis region. Some of it still remains outside the axis.

With a normal non-horizontal line series, the mark's of the maximum data value is positioned so that its bottom edge is at the axis maximum. This leaves the mark test itself outside the axis region. Could instead the left axis maximum position be shifted so that the mark text lies within the axis inner region ?


This can be solves applying an offset to the axes minimum and maximum values doing:

Code: Select all

  if Series1.Marks.Visible then
    With Chart1.Axes do
    begin
      Left.MaximumOffset:=10;
      Bottom.MinimumOffset:=15;
      Bottom.MaximumOffset:=10;
    end;
Also, when the normal line series left axis is inverted, the marks remain above the data point and do not shift below them. This contrasts with the behavior described above for horizontal line series where the the mark position switches to the left of the data point when the axis is inverted. Perhaps this is the desired behavior due to how such series are being viewed ?
I'll also list this to be reviewed.

BTW: You can create custom positioned marks using something like:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  APosition:TSeriesMarkPosition;
begin
  Series1.FillSampleValues();
  Chart1.Draw();

  APosition:=TSeriesMarkPosition.Create;
  try
    for i:=0 to Series1.Count-1 do
    begin
      APosition.Custom:=True;
      APosition.LeftTop.X:=Series1.Marks.Positions[i].LeftTop.X;
      APosition.LeftTop.Y:=Series1.Marks.Positions[i].LeftTop.Y-35;
      Series1.Marks.Positions[i]:=APosition;
    end;
  finally
      APosition.Free;
  end;
end;