TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
-
realsol
- Newbie
- Posts: 70
- Joined: Mon Feb 27, 2017 12:00 am
Post
by realsol » Thu Mar 09, 2017 7:06 pm
I searched but couldn't find this anywhere. Right now, I have created drill-down charts when a user clicks on a slice in a pie chart by adjusting the SQL. Getting the text was easy.
But OnClickLegend does not return a ValueIndex. I want to drill-down the same way in the legend as I do now in the Chart. How can I get the text of a legend item when clicked?
-
Yeray
- Site Admin
- Posts: 9614
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Mar 10, 2017 10:05 am
Hello,
This works fine for me:
Code: Select all
procedure TForm1.Chart1ClickLegend(Sender: TCustomChart; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Caption:=Chart1.Legend.Item[Chart1.Legend.Clicked(X, Y)].Text;
end;