Dim filter As String = "1=1"
With e.Form.Controls("设计人员")
If .Value IsNot Nothing Then
'Tables("甘特图临时表").Filter = "[方案设计完成时间节点_负责人] = '" & .Value & "' Or [深化设计完成时间节点_负责人] = '" & .Value & "'"
filter = "项目子任务负责人 = '" & .Value & "'"
End If
End With
Dim Chart As WinForm.Chart
Chart= Forms("我的甘特图").Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Gantt '图表类型为甘特图
Chart.Inverted = True '对调X轴和Y轴位置
Chart.AxisY.DateType= True 'Y轴为日期型
Chart.AxisY.AnnoFormatString = "MM-dd" '设置Y轴的标示格式
Chart.AxisY.MinDate = DataTables("甘特图临时表").Compute("min(项目子任务_计划开始日期)", filter) '设置Y轴的起始日期
Chart.AxisY.MaxDate = DataTables("甘特图临时表").Compute("max(项目子任务_计划完成日期)", filter) '设置Y轴的终止日期
Chart.AxisX.GridMajorVisible = False '隐藏X轴的网格线
With e.Form.Controls("设计人员")
Dim v As String = .Value
If .Value IsNot Nothing Then
Dim Customers As List(Of String) '提取药品中不重复值
Customers = DataTables("甘特图临时表").GetValues("项目子任务", filter & " and 项目子任务_计划完成日期 Is not null")
For Each Customer As String In Customers '
Dim drs As List(Of DataRow) = DataTables("甘特图临时表").Select(filter & " and 项目子任务 = '" & Customer & "' and 项目子任务_计划完成日期 is not null") '列名用符号|分割
Dim dts1(drs.Count-1) As Datetime
Dim dts2(drs.Count-1) As Datetime
For i As Integer = 0 To drs.Count - 1
Dim d1 As Date = drs(i)("项目子任务_计划开始日期")
Dim d2 As Date = drs(i)("项目子任务_计划完成日期")
Dim dt1 As Datetime = new Datetime(d1.Year, d1.Month, d1.Day, d1.Hour, d1.Minute, d1.Second)
Dim dt2 As Datetime = new Datetime(d2.Year, d2.Month, d2.Day, d2.Hour, d2.Minute, d2.Second)
dts1(i) = dt1
dts2(i) = dt2
Next
With Chart.SeriesList
.AddGanttSeries(Customer,dts1,dts2)
.AddGanttLabels("M月d日")
End With
Next
End If
End With