TeeChart ActiveX 7.0.1.4.
When the length of any one Chart.Series(i).Title is longer in width than the width of the chart istself, the legend will not be displayed.
Is this a know issue? Is there a fix? If not, will there be one?
Is there a known workaround aside from truncating the offending series title? Can the series title be wrapped in the legend?
Thank you
Legend does not display when series title is too long
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi cwdave,
You can do as in the example below where OnGetLegendText event is used to shorten the text so that it fits into the chart width.
You can do as in the example below where OnGetLegendText event is used to shorten the text so that it fits into the chart width.
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues 10
TChart1.Series(0).Title = "Line series with quite a long title so that the legend is wider than ChartRect's and it is not displayed"
TChart1.Legend.Alignment = laBottom
TChart1.Legend.LegendStyle = lsSeries
TChart1.Legend.Symbol.WidthUnits = lcsPixels
TChart1.Legend.Shadow.Visible = False
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
CurrentSize = TChart1.Canvas.TextWidth(LegendText)
RectWidth = (TChart1.Axis.Right.Position + TChart1.Aspect.Width3D) - TChart1.Axis.Left.Position
Do While (CurrentSize > (RectWidth - TChart1.Legend.Symbol.Width - 20))
LegendText = "" + Left(LegendText, Len(LegendText) - 1)
CurrentSize = TChart1.Canvas.TextWidth(LegendText)
Loop
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |