Page 2 of 2

Re: OnClickSeries is not triggered for 3D charts

Posted: Thu Jan 19, 2023 2:52 pm
by yeray
Hello,

With following delphi code, I'm importing your tee file and adding an OnClickSeries event to the created TDBChart.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var DBChart1: TDBChart;
begin
  Caption:=TeeMsg_Version;

  DBChart1:=TDBChart.Create(Self);
  LoadChartFromFile(DBChart1, 'F:\Downloads\teeFile.tee');
  DBChart1.Parent:=Self;

  DBChart1.OnClickSeries:=ChartOnClickSeries;
end;

procedure TForm1.ChartOnClickSeries(Sender:TCustomChart; Series:TChartSeries; ValueIndex:Integer;
                                    Button:TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ShowMessage('OnClickSeries event fired!')
end;

initialization

RegisterTeeStandardSeries;
And it seems to work fine for me here:
mstsc_yi0OQfZXaD.png
mstsc_yi0OQfZXaD.png (36.85 KiB) Viewed 16246 times
I'll give a try at the same in C++Builder.

Re: OnClickSeries is not triggered for 3D charts

Posted: Thu Jan 19, 2023 5:49 pm
by yeray
Hello,

Find attached the same project translated to C++Builder.
OnClickSeriesFMXBCB.zip
(10.21 KiB) Downloaded 724 times
I can't reproduce the problem with it, so I can't say what's wrong in your project yet.
However, you could try if it works for you so we can see if we are missing anything else.

Re: OnClickSeries is not triggered for 3D charts

Posted: Fri Jan 20, 2023 2:32 am
by 16892633
Hello,

Thank you for your patience.

The project you sent me is loading the 2D chart which is what I'm using in my app, but the 3D chart is where it fails.
I'm really sorry because I sent you the teeFile.tee generated by the 2D version and of course it works. Now I'm sending you the teeFile.tee for the 3D graph. I tried the C++Builder project you kindly sent me and it fails here.

Best regards,
Patricio Cerda

Re: OnClickSeries is not triggered for 3D charts

Posted: Fri Jan 20, 2023 10:19 am
by yeray
Hello,

I can reproduce the problem and simplifying it to the minimum, you just need two TBarSeries. The TAreaSeries doesn't look necessary:

Code: Select all

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);
  with Chart1 do
  begin
    Parent:=Self;
    Align:=alClient;

    AddSeries(TBarSeries).FillSampleValues(2);
    AddSeries(TBarSeries).FillSampleValues(2);

    OnClickSeries:=Chart1ClickSeries;
  end;
end;

procedure TForm1.Chart1ClickSeries(Sender: TCustomChart; Series: TChartSeries;
  ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ShowMessage('OnClickSeries event fired!');
end;
I've added it to the public tracker: #2584

Re: OnClickSeries is not triggered for 3D charts

Posted: Fri Jan 20, 2023 12:47 pm
by 16892633
Hello,

Just for the context: the other TBarSeries are there because at runtime, on my application, the user can select other datasets ('USD' and/or 'CLP' money exchange, and 'Realizados' o 'Pendientes' items). And the TAreaSeries are also activated or not by the user to show the composed amount between all items on the chart.

So, I activate or deactivate the series depending on the user selection.

Best regards,
Patricio Cerda

Re: OnClickSeries is not triggered for 3D charts

Posted: Mon Jan 23, 2023 5:50 pm
by yeray
Hello,

I've just fixed #2584 for the next maintenance release.

Re: OnClickSeries is not triggered for 3D charts

Posted: Mon Jan 23, 2023 10:10 pm
by 16892633
Excellent, thanks Yeray!