Highlighting a series when hovering over legen

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Highlighting a series when hovering over legen

Post by TestAlways » Thu Apr 02, 2015 6:11 pm

Some time ago I got some code from you that highlights a series when hovering over a legend item that corresponds to the chart--this works great.

I now have a chart that can have either a number of line series that highlight when hovering over the legend. But the data can also be viewed in a single bar series--but this gets buggy really quick.

In the attached demo, when it starts it creates line series. Hovering over the legend highlights the correct line series.

Clicking on the "Bars" to create a bar series and then hovering over the legend doesn't work--I can see why but I don't know how to fix it. So my questions:

1) With a bar series, how can I highlight the correct bar item when the mouse moves over items in the legend?
2) How can I keep the legend items from highlighting when the mouse is over the legend--but I just want the item in the chart to highlight? If I need to draw them myself, I know how to do that, just let me know.

Thank you,

Ed Dressel
Highlight Series.zip
(2.59 KiB) Downloaded 191 times

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

Re: Highlighting a series when hovering over legen

Post by Yeray » Tue Apr 07, 2015 7:50 am

Hello Ed,

TeeChart 2014.12 introduced the Hover feature that helps you to handle this as you can read in the "Mouse Hovering" section here:

If it doesn't fit your needs, you can still do it yourself, as you do, but when there's only one series in the chart, or the legend is set to use lsValues LegendStyle, then you'll have to access the first series' ValueColor array of colors and use the lClickedIdx as ValueIndex (lChart[0].ValueColor[lClickedIdx]) instead of using lClickedIdx to get the series to be modified (lChart[lClickedIdx].Color).
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