Is there a way to only display a LegendScrollBar tool if it is needed?
I mean, can I detect if the number of series' I have can't be displayed in the legend and in that case, add the scroll bar?
LegendScrollBar as required
Hi LVL,
You could compare the height of the legend with the legend height that X series need to be shown without scrollbar and activate or deactivate it:
You could compare the height of the legend with the legend height that X series need to be shown without scrollbar and activate or deactivate it:
Code: Select all
Private Sub TChart1_OnGetLegendRect(Left As Long, Top As Long, Right As Long, Bottom As Long)
legendHeight = Bottom - Top
wishedHeight = TChart1.Series(0).Count * 14
If legendHeight < wishedHeight Then
TChart1.Tools.Items(0).Active = True
Else
TChart1.Tools.Items(0).Active = False
End If
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Thanks!
Thanks Yeray - I actually studied the object model a bit more and solved it like this:
Code: Select all
int nNumInLegend = m_Chart.GetLegend().GetLastValue() - m_Chart.GetLegend().GetFirstValue();
if (nNumInLegend < m_nNumSeries)
{
...