Marks - behind series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jim
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am

Marks - behind series

Post by Jim » Sat Dec 06, 2003 5:29 pm

Greetings,

Using a chart with several line series and display mark on click, the marks for some series appear behind "later" line series.

Any way to have marks always "in front" of all lines?

Thanks.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 09, 2003 12:15 pm

I cannot reproduce the problem here using the TeeChart Pro v6.01. Could you please post the code that you're using so I can reproduce it here ?

Josep Lluis Jorge
http://support.steema.com

Jim
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am

Post by Jim » Tue Dec 09, 2003 5:05 pm

Hi,

There is nothing in the least special about my code. Just a chart with several line series. In fact all my multi-line series have this problem.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Dec 11, 2003 10:34 am

Does the problem happens using the following code ? :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i,j : integer;
begin
  for i:=0 to 5 do
      for j:=0 to 9 do
      Chart1[i].AddXY(j,Random(10),'ValueIndex'+TeeLineSeparator+inttostr(i),clteecolor);

  Charttool1.MouseAction :=mtmClick;

  for i :=0 to 5 do
    Chart1[i].Marks.MultiLine := true;
end;
Josep Lluis Jorge
http://support.steema.com

Jim
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am

Post by Jim » Fri Dec 12, 2003 7:28 pm

Hi,

Yes, it does. Is a simple case of some series lines obscuring the marks for other series.

The example code need not even be that complex:
for i:=0 to 1 do
for j:=0 to 9 do
Chart1.AddXY(j,Random(10),'ValueIndex'+TeeLineSeparator+inttostr(i),clteecolor);

==
in edit chart, turn all marks on and when the second series line is in front of first series "point" then mark for first point is obscured. 2d or 3d makes no difference. Is a case of mark tips not "floating" above all else, except of course other mark tips.

But, I'm not using any marktool. The code was first developed with TChart v4. Don't know right off how to make extra tool in your example function. :)

Thanks.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Dec 18, 2003 7:21 am

Hi, Jim.

I've tried to replicate the problem here (TC 6.01) and series marks were displayed over series lines. Which TeeChart version are you using ? Did you do any special tricks with series marks or are you simply displaying multiple series marks on plain chart ?
when the second series line is in front of first series "point" then mark for first point is obscured. 2d or 3d makes no difference. Is a case of mark tips not "floating" above all else, except of course other mark tips.
Is the problem that you have more than one series with visible marks and one series marks overlap other series marks ? In this case the only solution might be to manually reposition series marks after they are already drawn. This is generally not an easy task - you'll have to compare each mark bounding box with all other marks and if two boxes intersect, move one of them. Moving series marks is not a problem (see code bellow), the problem is calculating new position so that it does not intersect with any other series marks.

Code: Select all

// customize series mark position - just an example!
With Series1.Marks.Positions[0] do
begin
  Custom:=True;
  LeftTop.X:=100;
  LeftTop.Y:=60;
end;
One thing you should be careful about is series mark positions are created only after the chart is drawn. So, you can call Chart.Draw to create all positions or use the code bellow to manually create series mark position:

Code: Select all

Var APosition:TSeriesMarkPosition;
    APosition:=TSeriesMarkPosition.Create;
    try
      APosition.Custom:=True;
      APosition.LeftTop.X:=100;
      Series1.Marks.Positions[Index]:=APosition;
        ....
      APosition.LeftTop.X:=200;
      Series1.Marks.Positions[OtherIndex]:=APosition;
    finally
      APosition.Free;
    end;
Marjan Slatinek,
http://www.steema.com

Marcelo
Newbie
Newbie
Posts: 7
Joined: Sat Oct 04, 2003 4:00 am
Location: Brazil

Same Problem in 2D Bar Series

Post by Marcelo » Mon Jan 10, 2005 5:05 pm

I'm having the same problem ( marks behind the series ) when I use Bar Series and 2D ( in 3D it's OK ). I'm using the TChart that comes with Delphi 5.0. I calculate the marks points manually, but it isn't the cause. Is there a patch for this problem ?

Regards.

Marcelo

Marjan wrote:Hi, Jim.

I've tried to replicate the problem here (TC 6.01) and series marks were displayed over series lines. Which TeeChart version are you using ? Did you do any special tricks with series marks or are you simply displaying multiple series marks on plain chart ?
when the second series line is in front of first series "point" then mark for first point is obscured. 2d or 3d makes no difference. Is a case of mark tips not "floating" above all else, except of course other mark tips.
Is the problem that you have more than one series with visible marks and one series marks overlap other series marks ? In this case the only solution might be to manually reposition series marks after they are already drawn. This is generally not an easy task - you'll have to compare each mark bounding box with all other marks and if two boxes intersect, move one of them. Moving series marks is not a problem (see code bellow), the problem is calculating new position so that it does not intersect with any other series marks.

Code: Select all

// customize series mark position - just an example!
With Series1.Marks.Positions[0] do
begin
  Custom:=True;
  LeftTop.X:=100;
  LeftTop.Y:=60;
end;
One thing you should be careful about is series mark positions are created only after the chart is drawn. So, you can call Chart.Draw to create all positions or use the code bellow to manually create series mark position:

Code: Select all

Var APosition:TSeriesMarkPosition;
    APosition:=TSeriesMarkPosition.Create;
    try
      APosition.Custom:=True;
      APosition.LeftTop.X:=100;
      Series1.Marks.Positions[Index]:=APosition;
        ....
      APosition.LeftTop.X:=200;
      Series1.Marks.Positions[OtherIndex]:=APosition;
    finally
      APosition.Free;
    end;

Post Reply