Question:
How can I move back and forward in time on E3Chart’s horizontal axis?
Solution:
To do so, you must write a script that employsE3Chart’s horizontal axis’s SetHistoricPeriod method.
To move the button forward, use HorScaleBegin property (to obtain the horizontal axis’s initial value) + 1/24/60 (to add one minute) at the beginning, and HorScaleEnd property (to obtain the horizontal axis’s final value) + 1/24/60 (to add one minute) at the end.
To move the button back, use HorScaleBegin – 1/24/60 and HorScaleEnd – 1/24/60.
Check the model script below:
Sub CommandButton1_Click()
‘Move forward
Set Chart = Screen.Item(“E3Chart1”)
Chart.Axes.Item(“HorizontalAxis”).SetHistoricPeriod (Chart.HorScaleBegin)+1/24/60, (Chart.HorScaleEnd) +1/24/60
End SubSub CommandButton2_Click()
‘Move back
Set Chart = Screen.Item(“E3Chart1”)
Chart.Axes.Item(“HorizontalAxis “).SetHistoricPeriod (Chart.HorScaleBegin)-1/24/60, (Chart.HorScaleEnd) -1/24/60
End Sub
‘Move forward
Set Chart = Screen.Item(“E3Chart1”)
Chart.Axes.Item(“HorizontalAxis”).SetHistoricPeriod (Chart.HorScaleBegin)+1/24/60, (Chart.HorScaleEnd) +1/24/60
End SubSub CommandButton2_Click()
‘Move back
Set Chart = Screen.Item(“E3Chart1”)
Chart.Axes.Item(“HorizontalAxis “).SetHistoricPeriod (Chart.HorScaleBegin)-1/24/60, (Chart.HorScaleEnd) -1/24/60
End Sub