If the callout is below the line series and the callout is transparent, the arrow is drawn up through the box/text to the line. Is there a property I'm missing to have the arrow originate at the top of the callout box?
(I'm using version 7.06. Yes. I know. It's a long story.)
Thanks,
Chuck
TLineSeries Marks Arrows go through callout.
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
Hi Chuck,
I understand you have something like this, isn't it?
In that case, what you could do is to manually set the marks ArrowTo.Y positions as in the following example:
I understand you have something like this, isn't it?
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
with Chart1.AddSeries(TPointSeries) do
begin
FillSampleValues(10);
Marks.Visible:=true;
Marks.Callout.Length:=-50;
Marks.Arrow.Color:=clRed;
Marks.Transparent:=true;
end;
end;
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
tmpPos: TseriesMarkPosition;
begin
Chart1.View3D:=false;
with Chart1.AddSeries(TPointSeries) do
begin
FillSampleValues(10);
Marks.Visible:=true;
Marks.Callout.Length:=-50;
Marks.Arrow.Color:=clRed;
Marks.Transparent:=true;
end;
Chart1.Draw;
with Chart1[0] as TPointSeries do
begin
for i:=0 to Count-1 do
begin
tmpPos:=Marks.Positions.Position[i];
tmpPos.Custom:=true;
tmpPos.ArrowTo.Y:=tmpPos.LeftTop.Y;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
Yep. That's what I was looking for.
Thanks,
Chuck
Thanks,
Chuck
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
They decided to leave the labels opaque so I never verified the above fix. Now I have to do it for another reason and it's not working - I'm getting an exception.
In the onGetMarkText event I'm setting the arrow length and if I detect it's going below the line I have:
tmpPos := Sender.Marks.Positions.Position[ ValueIndex ];
tmpPos.Custom := True;
tmpPosArrowTo.Y := tmpPos.LeftTop.Y;
Unfortunately, tmpPos is nil.
(Note that I'm using a TLineSeries, not a TPointSeries.)
In the onGetMarkText event I'm setting the arrow length and if I detect it's going below the line I have:
tmpPos := Sender.Marks.Positions.Position[ ValueIndex ];
tmpPos.Custom := True;
tmpPosArrowTo.Y := tmpPos.LeftTop.Y;
Unfortunately, tmpPos is nil.
(Note that I'm using a TLineSeries, not a TPointSeries.)
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
Well, I figured out that the Positions haven't been created when onGetMarkText is called so I've moved the logic into the AfterDrawValues procedure. The code is executing without error and seems to be doing what I want but the arrow is still going to the bottom of the label.
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
I copy/pasted your example code into my project and it doesn't work either. Is this maybe a bug in my version of TeeChart?
Re: TLineSeries Marks Arrows go through callout.
Hello,
What about this? I've made it with TeeChart v7 and Delphi 7.
What about this? I've made it with TeeChart v7 and Delphi 7.
Code: Select all
//...
private
{ Private declarations }
procedure CalcMarks;
//...
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
with Chart1.AddSeries(TPointSeries) do
begin
FillSampleValues(10);
Marks.Visible:=true;
Marks.Callout.Length:=-50;
Marks.Arrow.Color:=clRed;
Marks.Transparent:=true;
end;
CalcMarks;
end;
procedure TForm1.CalcMarks;
var i: Integer;
tmpPos: TseriesMarkPosition;
begin
Chart1.Draw;
with Chart1[0] as TPointSeries do
begin
for i:=0 to Count-1 do
begin
tmpPos:=Marks.Positions.Position[i];
tmpPos.Custom:=true;
tmpPos.ArrowFrom.X:=GetHorizAxis.CalcPosValue(XValues[i]);
tmpPos.ArrowFrom.Y:=GetVertAxis.CalcPosValue(YValues[i]);
tmpPos.ArrowTo.X:=tmpPos.ArrowFrom.X;
tmpPos.ArrowTo.Y:=tmpPos.ArrowFrom.Y-Marks.Callout.Length-tmpPos.Height;
tmpPos.LeftTop.X:=tmpPos.ArrowFrom.X-(tmpPos.Width div 2);
tmpPos.LeftTop.Y:=tmpPos.ArrowTo.Y;
end;
end;
end;
procedure TForm1.Chart1Scroll(Sender: TObject);
begin
CalcMarks;
end;
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
CalcMarks;
end;
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
CalcMarks;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 9
- Joined: Wed Jul 08, 2009 12:00 am
Re: TLineSeries Marks Arrows go through callout.
Thanks, I finally figured it out - I had to make a final call to Chart.Draw after setting the Y value.