Help on hover

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Softdrill
Newbie
Newbie
Posts: 4
Joined: Tue Dec 09, 2014 12:00 am

Help on hover

Post by Softdrill » Sat Jan 31, 2015 3:32 pm

Hi,

I installed an update of TChart and discovered that points of my graph are highlighted when the mouse is hovered over these points.
I have searched sample application, help, support forum etc. (using hover, highlight etc as key words) but I am unable to find info on events and/or properties that allow me to use this feature.

To begin, I would like to use an event to display a series' Name, X and Y values in some controls on my form. Can you point me to some info that describes these features (help topics, forum entries, etc) ?

Thanks!

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

Re: Help on hover

Post by Yeray » Mon Feb 02, 2015 9:27 am

Hello,

There's an overview of this feature and the possibilities it supports at the What's New document, under "Mouse Hovering".
Softdrill wrote:To begin, I would like to use an event to display a series' Name, X and Y values in some controls on my form. Can you point me to some info that describes these features (help topics, forum entries, etc) ?
There's also a tool named TMarksTipTool that allows you to do things like this. You can take a look at the examples under "All features\Welcome !\Tools\Mark tips" in the "Features Demo" program shipped with the installation.
As with the regular Marks, you set it to show several predefined styles:

Code: Select all

  TSeriesMarksStyle=( smsValue,             { 1234 }
                      smsPercent,           { 12 % }
                      smsLabel,             { Cars } // If label is empty, no mark will be displayed
                      smsLabelPercent,      { Cars 12 % }
                      smsLabelValue,        { Cars 1234 }
                      smsLegend,            { (Legend.Style) }
                      smsPercentTotal,      { 12 % of 1234 }
                      smsLabelPercentTotal, { Cars 12 % of 1234 }
                      smsXValue,            { 1..2..3.. or 21/6/2014 }
                      smsXY,                { 123 456 }
                      smsSeriesTitle,       { Series1 }
                      smsPointIndex,        { 1..2..3... }
                      smsPercentRelative,   { 100%..90%..120%... }
                      smsLabelPercentValue, { Cars 12 % 1234 }
                      smsLabelOrValue       { Cars or 1234 }  // If label is empty, Value will be used
                      );
If you want further customization in this tool, you can capture the tool's OnGetText event to modify the text being displayed on the same.

Finally, if you want to do other actions when the mouse is over a series, you could always make it yourself using the OnMouseMove event. Ie:

Code: Select all

uses Series, TeeTools;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Chart1.AddSeries(TPointSeries).FillSampleValues();

  Chart1.OnMouseMove:=Chart1MouseMove;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var valueIndex: Integer;
begin
  valueIndex:=Chart1[0].Clicked(X, Y);
  if valueIndex>-1 then
  begin
    //do whatever you want
  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

Softdrill
Newbie
Newbie
Posts: 4
Joined: Tue Dec 09, 2014 12:00 am

Re: Help on hover

Post by Softdrill » Tue Feb 03, 2015 7:53 pm

Clear... thanks!

One more thing (hopefully it's not too dumb a question): how do I access Mark Tips Tool's properties and events in the IDE?
I opened the chart's editor and added a Mark Tip Tool. Now I like to implement the OnGetText and CancelHint events, but I cannot find these in the IDE (nor can I select the Mark Tip).
Should I manually declare, implement and assing these event handlers in code?

Thanks, Mark

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

Re: Help on hover

Post by Yeray » Wed Feb 04, 2015 8:13 am

Hello,

You can find the ChartTools (and the Series) and its events in the Object Inspector:
2015-02-04_0908.png
2015-02-04_0908.png (2.36 KiB) Viewed 6846 times
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

Softdrill
Newbie
Newbie
Posts: 4
Joined: Tue Dec 09, 2014 12:00 am

Re: Help on hover

Post by Softdrill » Wed Feb 04, 2015 8:08 pm

Thanks for that. I overlooked the Structure treeview because I expected the ChartTool to appear in the drop-down box in the Object Inspector.
Strangely enough; once it's been selected in the treeview, it appears in the drop-down box... :roll:

Post Reply