TPoint3DSeries - mouse move and click problems

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jim OBrien
Newbie
Newbie
Posts: 12
Joined: Thu Oct 11, 2007 12:00 am

TPoint3DSeries - mouse move and click problems

Post by Jim OBrien » Thu Oct 25, 2007 2:55 pm

I'm creating a TPoint3DSeries, aPS, on the fly and putting it along with a TSurfaceSeries, aSS, on a chart as follows:

aPS := TPoint3DSeries.Create(nil);
aPS.LinePen.Visible := false;
aPS.ParentChart := aChart;
aPS.Pointer.Draw3D := true;
aPS.DepthSize := 1;
aPS.OnGetMarkText := Self.GetMarkText;
aPS.OnMouseEnter := Self.SeriesMouseEnter;
aPS.OnMouseLeave := Self.SeriesMouseLeave;
aPS.OnClickPointer := Self.SeriesClickPointer;

Both series display fine, but:

1) I only get OnMouseEnter/OnMouseLeave messages reliably when I have set both aChart.Elevation and aChart.Rotation to 360 (i.e., the chart is "edge on")

2) I cannot get my OnClickPointer handler to fire at all (I have put a breakpoint in there, but it never gets hit when I click on a series point).

Can you advise? Thanks! Jim.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 26, 2007 10:17 am

Hi Jim,

This happens when Chart1.Aspect.Orthogonal:=false; and the difficulty to convert from 2D screen coordinates to 3D chart coordinates. This is a known issue and is very difficult to solve as neither GDI nor GDI+ provide methods for such conversions.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jim OBrien
Newbie
Newbie
Posts: 12
Joined: Thu Oct 11, 2007 12:00 am

Post by Jim OBrien » Fri Oct 26, 2007 11:19 am

narcis wrote:Hi Jim,

This happens when Chart1.Aspect.Orthogonal:=false; and the difficulty to convert from 2D screen coordinates to 3D chart coordinates. This is a known issue and is very difficult to solve as neither GDI nor GDI+ provide methods for such conversions.
Understood, in general, but you do the geometric calculations to translate from points to screen coordinates when you plot the chart, so there must surely be a way (however slow) to do the inverse operation.

Jim OBrien
Newbie
Newbie
Posts: 12
Joined: Thu Oct 11, 2007 12:00 am

Still doesn't fire

Post by Jim OBrien » Fri Oct 26, 2007 11:52 am

narcis wrote:Hi Jim,

This happens when Chart1.Aspect.Orthogonal:=false; and the difficulty to convert from 2D screen coordinates to 3D chart coordinates. This is a known issue and is very difficult to solve as neither GDI nor GDI+ provide methods for such conversions.
I tried both
chtAC.Aspect.Orthogonal := true;
and
chtAC.View3DOptions.Orthogonal := true;
but I could not get OnClickPointer for my TPoint3DSeries to fire when I clicked on points on the chart.

Is there something else I need to do?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 26, 2007 2:24 pm

Hi Jim,

It works fine for me here dropping a TChart in a form with a TSurfaceSeries and a TPoint3DSeries and this code:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeePoin3, TeEngine, TeeSurfa, ExtCtrls, TeeProcs, Chart,
  TeeComma;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TSurfaceSeries;
    Series2: TPoint3DSeries;
    TeeCommander1: TTeeCommander;
    procedure FormCreate(Sender: TObject);
    procedure Series2ClickPointer(Sender: TPoint3DSeries; ValueIndex, X,
      Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var x,z: Integer;
    y: Double;
begin
  for x:=0 to 10 do
  begin
    for z:=0 to 10 do
    begin
      y:=random;
      Series1.AddXYZ(x,y,z);
      Series2.AddXYZ(x,y,z);
    end;
  end;
end;

procedure TForm1.Series2ClickPointer(Sender: TPoint3DSeries; ValueIndex, X,
  Y: Integer);
begin
  Chart1.Title.Text[0]:='Point clicked: ' + IntToStr(ValueIndex);
end;

end.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jim OBrien
Newbie
Newbie
Posts: 12
Joined: Thu Oct 11, 2007 12:00 am

Following up

Post by Jim OBrien » Fri Oct 26, 2007 6:40 pm

I did it at runtime, like this:

Code: Select all

   aChart.Aspect.Orthogonal := true;

   aSS := TSurfaceSeries.Create(nil);
   aSS.Pen.Visible := false;
   aSS.ParentChart := aChart;

   aPS := TPoint3DSeries.Create(nil);
   aPS.LinePen.Visible := false;
   aPS.ParentChart := aChart;
   aPS.Pointer.Draw3D := true;
   aPS.DepthSize := 1;
   aPS.OnGetMarkText := Self.GetMarkText;
   aPS.OnClickPointer := Self.SeriesClickPointer;
but a breakpoint inside SeriesClickPointer never gets called.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 30, 2007 9:50 am

Hi Jim,

Could you please try with a new example project like I suggested in my previous reply?

Thanks in advance!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply