Page 1 of 1

Highlighting a series when hovering over legen

Posted: Thu Apr 02, 2015 6:11 pm
by 10546565
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

Re: Highlighting a series when hovering over legen

Posted: Tue Apr 07, 2015 7:50 am
by yeray
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:
http://www.steema.com/linkIn/WhatsNewVCL

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).