Page 1 of 1

Click on TPoint3DSeries item

Posted: Mon Jun 19, 2017 11:41 am
by 16579079
Hello!

I'm presenting data in a 3-D view. I add "Items" with DataSeries.AddXYZ(...) and this works fine.

Now I want to add an "Information text" for each "Item", and when you hover over the point with the mouse I want to present the "Information text" in a TEditBox...

Can this be done? I cant find any AddXYZ(X, Y, Z, 'Text') function!? And I can't find how to set an OnEnter event on the Items.

Best regards, Mikael

Re: Click on TPoint3DSeries item

Posted: Tue Jun 20, 2017 7:04 am
by yeray
Hello Mikael,
Lenfors wrote:I cant find any AddXYZ(X, Y, Z, 'Text') function!?
There's an AddXYZ(X, Y, Z, 'Text', Color) function:

Code: Select all

Function TCustom3DSeries.AddXYZ(Const AX,AY,AZ:TChartValue;
                                Const AXLabel:String; AColor:TColor):Integer;
Lenfors wrote:And I can't find how to set an OnEnter event on the Items.
This works fine for me here:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.OnMouseEnter:=Series1MouseEnter;
  Series1.OnMouseLeave:=Series1MouseLeave;
end;

procedure TForm1.Series1MouseEnter(Sender: TObject);
var ValueIndex: Integer;
    ZVal: Double;
begin
  ValueIndex:=Series1.Clicked(Chart1.GetCursorPos);
  if ValueIndex>-1 then
    Edit1.Text:='ValueIndex: ' + IntToStr(ValueIndex) + ', XValue: ' + FormatFloat('', Series1.XValue[ValueIndex]) +
                ', YValue: ' + FormatFloat('', Series1.YValue[ValueIndex]) + ', ZValue: ' + FormatFloat('', Series1.ZValue[ValueIndex]) +
                ', Label: ' + Series1.Labels[ValueIndex];
end;

procedure TForm1.Series1MouseLeave(Sender: TObject);
begin
  Edit1.Text:='';
end;