KeyChar Property Example

The event procedure in this example makes it possible for the user to rotate the specified chart by using the number keys. Note that Charts(0) must refer to either a pie chart or a doughnut chart. Note also that this event procedure is declared as required by Visual Basic. For more information about using event procedures, see Declaring and Using Event Procedures in VBScript.

Private Sub ChartSpace1_KeyPress(ByVal ChartEventInfo As OWC.WCChartEventInfo)
    kc = Asc(ChartEventInfo.KeyChar)
    If kc > 47 And kc < 58 Then 'key was a number key
        ChartSpace1.Charts(0).FirstSliceAngle = (kc - 48) * 10
    End If
End Sub