Zooming and panning
Q: How can I determine if a Chart is zoomed or not ?
When the chart is "unzoomed", the axes are all set to Automatic again. So, when all axes (or the axes you want) are "Automatic", it means the chart is not zoomed. In TeeChart Ax v4 and 5 the situation is made easier by the use of the Zoomed property. This property returns True when the Chart is zoomed and False when it isn't. You can check this functionality by putting the following code into a CommandButton and then clicking it having zoomed or unzoomed a Chart. Private Sub Command1_Click() Q:In IE5, zooming and panning don't work. Why ?This symptom we've noticed although haven't yet documented. The effect and resolution is similar to that when using JScript in IE4. For example put a Chart on an HTML page and define a VBScript to add a Series and populate it. In IE 4 you can run and zoom on the Chart. Do the same with JScript and it won't work. You need to add a TeeChart event to the page, which can be empty, then with the JScripted page it works OK too. The same happens with IE5 but a VBScripted Chart behaves in the same way as an IE4 JScripted Chart.eg. JScript -> add: <SCRIPT LANGUAGE="JavaScript" FOR="TChart1" EVENT="OnAfterDraw()"> <!-- --> </SCRIPT> eg. VBScript -> add: <SCRIPT LANGUAGE="VBScript"> Sub TChart1_OnAfterDraw() ' empty End Sub </SCRIPT> You should now be able to zoom and scroll the Chart. Q:How can I get zoom to work with my custom axes?Custom axes can be made to work with zoom by the use of some TeeChart events. Try the following code in a VB6 form with a TeeChart Pro ActiveX Control on it: Dim myX0, myX1, myY0, myY1 As Long Private Sub Form_Load() TChart1.AddSeries scLine TChart1.Series(0).FillSampleValues 10 TChart1.Panel.MarginBottom = 15 TChart1.Panel.MarginLeft = 15 TChart1.Series(0).VerticalAxisCustom = TChart1.Axis.AddCustom(False) With TChart1.Axis.Custom(0) .AxisPen.Color = vbGreen .Title.Caption = "Extra axis" .Title.Font.Bold = True .Title.Angle = 90 End With TChart1.Series(0).HorizontalAxisCustom = TChart1.Axis.AddCustom(True) With TChart1.Axis.Custom(1) .AxisPen.Color = vbGreen .Title.Caption = "Extra axis2" .Title.Font.Bold = True End With End Sub Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As _ TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long) myX0 = X myY0 = Y End Sub Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As _ TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long) myX1 = X myY1 = Y End Sub Private Sub TChart1_OnUndoZoom() TChart1.Axis.Custom(0).Automatic = True TChart1.Axis.Custom(1).Automatic = True End Sub Private Sub TChart1_OnZoom() With TChart1.Axis.Custom(0) .SetMinMax .CalcPosPoint(myX1), .CalcPosPoint(myX0) End With With TChart1.Axis.Custom(1) .SetMinMax .CalcPosPoint(myY1), .CalcPosPoint(myY0) End With End Sub You should now be able to zoom and scroll the custom axes. |