(一)附加轴
1.1 复制轴
TeeChart提供5个轴与数据系列,Left,Right,Top,Bottom和Depth相关联。向图表添加新系列时,可以定义系列应与哪些轴相关(转到“Series”选项卡“General”页面)。您可以使用Axis Customdraw方法在图表上的任何位置重复前4轴中的任何一个(或全部)。请注意,此方法会复制Axis,但不会添加新的自定义轴。
例:
'fill the Series for this example with random data Private Sub Command1_Click() Dim t As Integer For t = 0 To 20 TChart1.Series(0).AddXY t, ((100 * Rnd) + 1) - ((Rnd * 70) + 1), "", vbRed Next t End Sub 'Put this code in the TChart1_OnBeforeDrawSeries() event: Dim posaxis As Integer With TChart1 If .Axis.Left.Maximum > 0 Then 'When scrolling or on zoom always keep the gridlines enclosed in the Chart rectangle .Canvas.ClipRectangle .Canvas.Left, .Canvas.Top, (.Canvas.