Page 1 of 1

Changing behaviour of legend checkboxes

Posted: Mon Feb 20, 2006 7:32 pm
by 9233315
Is it possible to change the default behaviour of the legend's checkboxes? I understand that currently checking or unchecking the checkboxes will display/hide the associated series in the chart.

Currently, I am drawing a horizontal line in the OnAfterDraw event which denotes the min and max values observed in the Series. I would like the checkboxes to instead show/hide this min/max line. I want my series to always be visible.

Thanks in advance,

Andrew

Posted: Tue Feb 21, 2006 8:43 am
by narcis
Hi Andrew,

The only way I can think of is doing something like the All Features\Welcome!\Miscellaneous\Legend\Multiple Legens example or All Features\Welcome!\Miscellaneous\Legend\Drawing more text at the TeeChart features demo. The demo can be found at TeeChart's program group. Then you should set the checkbox in the examples to enable or disable that view and the line being drawn in the canvas.

Posted: Tue Feb 21, 2006 3:29 pm
by 9233315
NarcĂ­s,

Thanks for the tip, I'll give that a try.

I'm having another strange problem at the moment. I enabled the Chart1.Legend.CheckBoxes on my chart, and the checkboxes now display properly, and are checked. If I set the Series.Visible property the series' checkboxes check and uncheck properly. However, clicking on the legend doesn't do anything. It doesn't hide/show the series.

After a little troubleshooting, it turns out that when I click on the legend, it's the OnClickBackground event that's getting called, and OnClickLegend doesn't get called at all. I suspect that this has something to do with the fact that I've set legend.visible := false, and manually call chart.drawlegend in the OnAfterDraw event so that it is drawn on top of the horizontal min/max lines I mentioned in my previous post.

Does this make sense to you? Can you think of a way that I can re-enable clicking on my legend to hide/show my series?

Thanks in advance,

Andrew

Posted: Tue Feb 21, 2006 4:06 pm
by 9233315
Actually, I think I got it...

I just added a line in my OnClickBackground that checks to see if RSSIChart.Legend.Clicked(x,y) <> -1. If it is, I call my own routine which uses the chart1.legend.items.Top parameter to determine which series was clicked, then I set Series.Visible := not(Series.Visible). Seems to work quite well, and I get to keep drawing my legend manually :)

Andrew