Multiple Pies (Concentric) mouse click not function

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
n2n
Newbie
Newbie
Posts: 19
Joined: Mon Nov 23, 2015 12:00 am

Multiple Pies (Concentric) mouse click not function

Post by n2n » Tue Oct 04, 2016 9:46 am

Current using BDS2006,

When i apply 2 pie series with (Concentric), Series1 and Series2, I have handled OnClick event for both series but only Series2(Outer Pie) OnClick will be triggered. I have tried to handle TChart.OnClickSeries, but regardless of which series I am clicking, in OnClickSeries event, the sender is always Series2(Outer Pie). Any idea on how can I handle OnClick event for both Pies?

Thanks

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

Re: Multiple Pies (Concentric) mouse click not function

Post by Yeray » Tue Oct 04, 2016 1:26 pm

Hello,

You could use OnMouseDown event and call the clicked function of both series in it. Ie:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i:Integer;
begin
  Chart1.View3D:=false;
  Chart1.Hover.Visible:=false;

  for i:=0 to 1 do
  with Chart1.AddSeries(TPieSeries) as TPieSeries do
  begin
    MultiPie:=mpConcentric;
    FillSampleValues();
  end;

  Chart1.OnMouseDown:=ChartMouseDown;

  Memo1.Clear;
end;

procedure TForm1.ChartMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
                                X, Y: Integer);
var SeriesIndex,
    ValueIndex:  Integer;
begin
  for SeriesIndex:=0 to Chart1.SeriesCount-1 do
  begin
    ValueIndex:=Chart1[SeriesIndex].Clicked(X,Y);
    if ValueIndex>-1 then
      Memo1.Lines.Add('OnMouseDown event, '+SeriesTitleOrName(Chart1[SeriesIndex])+', ValueIndex: '+IntToStr(ValueIndex));
  end;
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