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 » Sat Mar 04, 2017 7:14 pm
I am brand new to Tee Chart so first, i appologise for my terms in this question.
I am trying to return the name of a Slice of a Pie chart or a Bar Chart when a customer double clicks it. I want to use this name to edit my SQL to show a new chart based on the name of the slice double clicked. I use the following code to return the Series and Point on the chart, but I need a way of converting the point to a name. I know this must be a very basic question but didn't find an answer by searching.
Code: Select all
procedure TMainForm.DBChart1DblClick(Sender: TObject);
var t,tmp : Integer;
x,y : Double;
begin
Series1.GetCursorValues(x,y);
for t:=0 to DBChart1.SeriesCount-1 do
begin
tmp:=DBChart1.Series[t].GetCursorValueIndex;
if tmp<>-1 then
ShowMessage(' Clicked Series: '+DBChart1.Series[t].Name+' at point: '+inttostr(tmp));
end;
I hope this makes sense. Thanks.
-
realsol
- Newbie
- Posts: 70
- Joined: Mon Feb 27, 2017 12:00 am
Post
by realsol » Sat Mar 04, 2017 8:22 pm
Found the answer. Sorry guys. This is my first day using the component:
Code: Select all
procedure TMainForm.DBChart1DblClick(Sender: TObject);
var t,tmp : Integer;
x,y : Double;
begin
Series1.GetCursorValues(x,y);
for t:=0 to DBChart1.SeriesCount-1 do
begin
tmp:=DBChart1.Series[t].GetCursorValueIndex;
if tmp<>-1 then
ShowMessage(' Clicked Series: '+DBChart1.Series[t].Name+' at point: '+ Series1.Labels[tmp]);
end;
end;