Show labels by Right-Clicking a Slice or Bar in a chart

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Show labels by Right-Clicking a Slice or Bar in a chart

Post by realsol » Wed Mar 22, 2017 6:07 am

I have two charts on one form. When I display labels, a lot of them overlap. So I created a Popup menu for both charts that lets the users hide the labels if the chart is overlapping them too much. The amounts and labels still show in the legend.

But is there a way that I could set up, let's say a pie slice, so if the user is not displaying labels, they could Right-Click the slice and have the label shown to them at the position of the mouse pointer? Though, keeping in mind I normally would have a popup menu show when the chart is right-clicked.

Or, is there a way when the labels are hidden, to show a 'hint' per slice or bar on a chart when they hover their mouse over the chart?

Thanks.

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

Re: Show labels by Right-Clicking a Slice or Bar in a chart

Post by Yeray » Wed Mar 22, 2017 8:37 am

Hello,

You can use the series Clicked(X, Y) function to get the ValueIndex of the point for the given X/Y pixel position. You can call this at OnMouseDown or at OnMouseMove events to show a menu if you like.
Note Clicked function returns -1 if there's no point at the given X/Y pixel position.

Also note there's an OnClickSeries for the chart that directly gives you the Series and the ValueIndex.
realsol wrote:Or, is there a way when the labels are hidden, to show a 'hint' per slice or bar on a chart when they hover their mouse over the chart?
There's the TMarksTipTool to do precisely that (Chart Tools only available with the Pro version).
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