TeeChart Legend
-
- Newbie
- Posts: 36
- Joined: Wed Aug 24, 2016 12:00 am
TeeChart Legend
Is there a means of allowing the user to drag and resize the legend for a chart?
Re: TeeChart Legend
Hello,
You can do it manually using the mouse events. Ie:
You can do it manually using the mouse events. Ie:
Code: Select all
uses Series;
var legendDragging: Boolean;
oldPos: TPoint;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.AddSeries(TBarSeries).FillSampleValues();
legendDragging:=false;
end;
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Chart1.Legend.Clicked(X, Y)>-1 then
begin
legendDragging:=True;
oldPos:=Point(X,Y);
end;
end;
procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
legendDragging:=False;
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Chart1.Legend.Clicked(X, Y)>-1 then
begin
Chart1.Cursor:=crHandPoint;
end;
if legendDragging then
begin
Chart1.Legend.CustomPosition:=true;
Chart1.Legend.Left:=Chart1.Legend.Left+(X-oldPos.X);
Chart1.Legend.Top:=Chart1.Legend.Top+(Y-oldPos.Y);
oldPos:=Point(X,Y);
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |