ITChart.OnSeriesBeforeAdd
ITChart
property OnSeriesBeforeAdd: TTChartOnSeriesBeforeAdd;
Type Library
TeeChartx
Description
The OnSeriesBeforeAdd event is triggered whenever a new point is going to be Added or Inserted. You can delegate this event in your Form's code to, for example, control if new points will be really added to the Series. This event also happens when a Series component is connected to a Table or Query.
*NOTE*
The OnSeriesBeforeAdd event has superceeded the now redundant OnDatabaseRecord event and should be used in place of the TeeChart v4 event.
Example [Visual Basic]:
Dim ApplyFunction As Boolean
Private Sub Check1_Click()
ApplyFunction = Check1.Value
End Sub
Private Sub Command1_Click()
AddData
End Sub
Private Sub Form_Load()
Check1.Caption = "Apply custom function to data y=(y*x)+2"
Command1.Caption = "Refresh data"
TChart1.AddSeries scLine
ApplyFunction = False
AddData
End Sub
Private Sub AddData()
With TChart1.Series(0)
.Clear
.AddXY 1, 1, "", clTeeColor
.AddXY 2, 2, "", clTeeColor
.AddXY 3, 3, "", clTeeColor
.AddXY 4, 4, "", clTeeColor
.AddXY 5, 5, "", clTeeColor
End With
End Sub
Private Sub TChart1_OnSeriesBeforeAdd(ByVal SeriesIndex As Long, Continue As Boolean)
If ApplyFunction = True Then
With TChart1.Series(SeriesIndex)
.YValues.TempValue = (.YValues.TempValue * .XValues.TempValue) + 2
End With
End If
End Sub