Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= Forms("窗口1").Controls("Chart1") \' 引用窗口中的图表 Chart.ChartType = ChartTypeEnum.Bar \'图表类型该为Bar(条形) Chart.LegendVisible = True \'显示图例 Chart.SeriesList.Clear() \'清除图表原来的图系 For n As integer = 0 To 1 Series = Chart.SeriesList.Add() \'增加一个图系 Series.Text = "图系" & (n + 1) Series.Length = 10 \'图系包括10个数据点 For i As integer = 1 to 5 \'指定每个数据点的位置 Series.X(i) = i \'指定水平坐标 Series.Y(i) = i + n * 2 + Rand.Next(5) \'垂直坐标用随即数生成 Next Next