Hi,
Is there any way to detect what pie slice the mouse is over - the way we recognize it in the SeriesClick event for example - where the ValueIndex tells you the slice?
I want to use this to animate the slide the user is on by exploding it - for a more dynamic look.
procedure TForm5.Series1Click(Sender: TChartSeries; ValueIndex: Integer;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
How to detect pie slice on mouse move
Re: How to detect pie slice on mouse move
Hello,
You could use the Clicked event in the OnMouseMove event. Here it is an example of it:
You could use the Clicked event in the OnMouseMove event. Here it is an example of it:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TPieSeries).FillSampleValues();
end;
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var ClickedIndex, i, tmp: Integer;
begin
ClickedIndex:=Chart1[0].Clicked(X,Y);
if ClickedIndex>-1 then
begin
for i:=0 to Chart1[0].Count-1 do
begin
if i=ClickedIndex then tmp:=15
else tmp:=0;
(Chart1[0] as TPieSeries).ExplodedSlice[i]:=tmp;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |