Forms("设计计划甘特图").Show()
Dim Chart As WinForm.Chart
Chart= Forms("设计计划甘特图").Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Gantt '图表类型为甘特图
Chart.SeriesList.Clear
Dim t As Table = Tables("设计分配计划表")
Chart.Inverted = True '对调X轴和Y轴位置
Chart.AxisY.DateType= True 'Y轴为日期型
Chart.AxisY.AnnoFormatString = "MM-dd" '设置Y轴的标示格式'
Chart.AxisX.GridMajorVisible = False '隐藏X轴的网格线\
With e.Form.Controls("设计人员")
Dim v As String = .Value
If .Value IsNot Nothing Then
Dim drs As List(Of DataRow)
drs = DataTables("设计分配计划表").Select("[设计3D_担当] = '" & .Value & "' or [设计2D_担当] = '" & .Value & "'")
For Each dr As DataRow In drs
Dim _3dstart As Date = dr("设计3D_计划开始日期")
Dim _3dend As Date = dr("设计3D_计划结束日期")
If _3dstart = _3dend Then _3dend = _3dend.AddDays(1).AddSeconds(-1)
Dim _2dstart As Date = dr("设计2D_计划开始日期")
Dim _2dend As Date = dr("设计2D_计划结束日期")
If _2dstart = _2dend Then _2dend = _2dend.AddDays(1).AddSeconds(-1)
With Chart.SeriesList
If dr("设计3D_担当") = dr("设计2D_担当") Then
.AddGanttSeries(dr("治具规格"),New DateTime() {_3dstart,_2dstart },New DateTime() {_3dend ,_2dend })
Else
If dr("设计3D_担当") = v Then
.AddGanttSeries(dr("治具规格"),New DateTime() {_3dstart},New DateTime() {_3dend })
ElseIf dr("设计2D_担当") = v Then
.AddGanttSeries(dr("治具规格"),New DateTime() {_2dstart },New DateTime() {_2dend })
End If
End If
.AddGanttLabels("M月d日")
End With
Next
End If
End With