Value Labels

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
José Araújo
Newbie
Newbie
Posts: 8
Joined: Fri Jul 09, 2010 12:00 am

Value Labels

Post by José Araújo » Mon Jan 31, 2011 5:00 pm

Good morning,
I have the following problem with the value labels.
1 - LegendActive.JPG
1 - Legend Active.
1 - LegendActive.JPG (116 KiB) Viewed 1860 times
2 - LegendInactive.JPG
Legend inactive and Changing Position of the Label Value.
2 - LegendInactive.JPG (121.28 KiB) Viewed 1849 times
3 - ActivatingLegendAgain.JPG
3 - Activating legend again.
3 - ActivatingLegendAgain.JPG (117.29 KiB) Viewed 1856 times
await solution, thanks.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Value Labels

Post by Yeray » Wed Feb 02, 2011 12:52 pm

Hi José,

As the mark has been moved, it has to be recalculated if the chart changes. You could call a method like following when the legend visibility changes:

Code: Select all

procedure TForm1.RecalcMarks;
var i, tmpx, dx: Integer;
    pos: TSeriesMarkPosition;
begin
  for i:=0 to Chart1[0].Count-1 do
  begin
    tmpx:=Chart1[0].CalcXPos(i) + (Chart1[0] as TBarSeries).BarWidth div 2;

    pos:=Chart1[0].Marks.Positions[i];
    if (tmpx <> pos.ArrowFrom.X) then
    begin
      dx:=pos.ArrowTo.X - pos.ArrowFrom.X;
      pos.ArrowFrom.X:=tmpx;
      pos.ArrowTo.X:=tmpx + dx;
      pos.LeftTop.X:=tmpx + dx - (pos.Width div 2);
    end;
  end;

  Chart1.Repaint;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply