Hi, how it is possible to show a trend line on a zoomed area ? the trend stays allways on the full serial , is this possible to fix the first element and the last to include in the calculation of the trend?
regards
JP
show trend on a zoomed area
Re: show trend on a zoomed area
Hi,
You could populate a dummy series with only the visible values at OnZoom event, and show the Trend of this dummy series.
Ie:
If you want to get the Trend line of all the values when you zoom out, you could use the OnUndoZoom for it. Then you could use the source series with the trend function:
You could populate a dummy series with only the visible values at OnZoom event, and show the Trend of this dummy series.
Ie:
Code: Select all
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.AddSeries scBar
TChart1.Series(0).Name = "Source"
TChart1.Series(0).FillSampleValues 50
TChart1.AddSeries scBar
TChart1.Series(1).Name = "Dummy"
TChart1.Series(1).ShowInEditor = False
TChart1.Series(1).ShowInLegend = False
TChart1.Series(1).Active = False
TChart1.AddSeries scLine
TChart1.Series(2).Name = "Trend"
TChart1.Series(2).SetFunction tfTrend
TChart1.Series(2).DataSource = TChart1.Series(1)
End Sub
Private Sub TChart1_OnZoom()
TChart1.Environment.InternalRepaint
TChart1.Series(1).Clear
Dim i As Integer
For i = TChart1.Series(0).FirstValueIndex To TChart1.Series(0).LastValueIndex
TChart1.Series(1).AddXY TChart1.Series(0).XValues.Value(i), TChart1.Series(0).YValues.Value(i), "", clTeeColor
Next i
TChart1.Series(2).DataSource = TChart1.Series(1)
TChart1.Series(2).CheckDataSource
End Sub
Code: Select all
Private Sub TChart1_OnUndoZoom()
TChart1.Series(2).DataSource = TChart1.Series(0)
End Sub
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 3
- Joined: Tue Jan 24, 2012 12:00 am
Re: show trend on a zoomed area
Hi,
Thanks a lot, I did it, it's fine...
regards
JP
Thanks a lot, I did it, it's fine...
regards
JP