Hi Tony,
I'm afraid that the only modifiable string in a series is the title and the value labels. I think that the better solution four you would be the implementation of the ticket (TA05010743, I've incremented it's priority) that demands the implementation of the series' property "tag". This property stores an
integer in TeeChart VCL and an
object in TeeChart for .NET. If it would be an object, you could add your series' string (different to the title) and you could use OnGetLegendText to draw this string. If it would be an integer, you could store an index to an array of strings and work the same way.
When the Tag property will be available, you will be able to do this:
Code: Select all
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
TChart1.AddSeries scArea
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues
TChart1.Series(1).FillSampleValues
TChart1.Series(0).Title = "Area Series"
TChart1.Series(1).Title = "Line Series"
TChart1.Series(0).Tag = "AreaTag"
TChart1.Series(1).Tag = "LineTag"
TChart1.Legend.LegendStyle = lsSeries
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
LegendText = TChart1.Series(ValueIndex).Tag
End Sub
Or, this if the Tag is an integer:
Code: Select all
Dim SeriesStrings() As String
Dim NumEls As Integer
Private Sub Form_Load()
TeeCommander1.Chart = TChart1
NumEls = 0
TChart1.AddSeries scArea
TChart1.AddSeries scLine
TChart1.Series(0).FillSampleValues
TChart1.Series(1).FillSampleValues
TChart1.Series(0).Title = "Area Series"
TChart1.Series(1).Title = "Line Series"
TChart1.Legend.LegendStyle = lsSeries
End Sub
Private Sub TChart1_OnAddSeries(ByVal SeriesIndex As Long)
ReDim Preserve SeriesStrings(NumEls + 1) As String
SeriesStrings(NumEls) = "Series " + Str$(SeriesIndex)
TChart1.Series(SeriesIndex).Tag = SeriesIndex
NumEls = NumEls + 1
End Sub
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
LegendText = SeriesStrings(TChart1.Series(ValueIndex).Tag)
End Sub
Please, see the attached example in delphi, where the Tag property is an integer: