Dim dt As DataTable = DataTables("表A")
Dim tb As Table = Tables("表A")
Dim Chart As WinForm.Chart
Chart= Forms("窗口1").Controls("Chart1")
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.ChartType = ChartTypeEnum.Gantt '图表类型为甘特图
Chart.Inverted = True '对调X轴和Y轴位置
Chart.AxisY.DateType= True 'Y轴为日期型
Chart.AxisY.AnnoFormatString = "MM-dd" '设置Y轴的标示格式
Chart.AxisY.MinDate = #01/01/2010# '设置Y轴的起始日期
Chart.AxisY.MaxDate = #04/30/2010# '设置Y轴的终止日期
Chart.AxisX.GridMajorVisible = False '隐藏X轴的网格线
Dim sat() As String
Dim en() As String
Dim vsa As String
Dim ven As String
Dim vsat As new List(of String)
Dim vend As new List(of String)
For Each c As Col In tb.Cols
If c.Name Like "'*开始'" Then
vsat.Add(c.name)
End If
If c.Name Like "'*结束'" Then
vend.Add(c.name)
End If
Next
sat = vsat.ToArray()
en = vend.ToArray()
For i As Integer = 0 To sat.Length -1
If vsa = Nothing Then
vsa = tb.Current(sat(i))
Else
vsa = vsa & "," & tb.Current(sat(i))
End If
Next
For i As Integer = 0 To en.Length -1
If ven = Nothing Then
ven = tb.Current(en(i))
Else
ven = vsa & "," & tb.Current(en(i))
End If
Next
MessageBox.Show(ven & "|" & vsa)
With Chart.SeriesList
.AddGanttSeries("任务五", New DateTime(){vsa}, New DateTime(){ven})
'.AddGanttSeries("任务五", New DateTime() {tb.Current("物料开始"), tb.Current("生产开始")}, New DateTime() {tb.Current("物料结束"),tb.Current("生产结束")})
.AddGanttLabels("M月d日")
End With
数据类型错误 找不到方法