此主题相关图片如下:7.png
如图片所示,怎么样可以实现我的效果
Dim dt As DataTable = DataTables("SMT排期")
Dim tb As Table = Tables("排期表_SMT排期表")
Dim Chart As WinForm.Chart
Chart= Forms("排期表").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 = dt.Compute("min(资料_计划_开始)")'设置Y轴的起始日期
Chart.AxisY.MaxDate = dt.Compute("max(生产_计划_完成)")''''设置Y轴的终止日期
Chart.AxisX.GridMajorVisible = False '隐藏X轴的网格线
Dim sat() As Date
Dim en() As Date
Dim vsat As new List(of DateTime)
Dim vend As new List(of DateTime)
'--------------------------''''
Dim sat1() As Date
Dim en1() As Date
Dim vsat1 As new List(of DateTime)
Dim vend1 As new List(of DateTime)
'----------------------------'''
'Dim r As Row = tb.Current
For Each r As Row In tb.Rows
For Each c As Col In tb.Cols
If c.Name Like "*计划_开始" Then
vsat.Add(r(c.name))
End If
If c.Name Like "*计划_完成" Then
vend.Add(r(c.name))
End If
Next
sat = vsat.ToArray()
en = vend.ToArray()
'-----------------------------------------
For Each c As Col In tb.Cols
If c.Name Like "*实际_开始" Then
vsat1.Add(r(c.name))
End If
If c.Name Like "*实际_完成" Then
vend1.Add(r(c.name))
End If
Next
sat1 = vsat1.ToArray()
en1 = vend1.ToArray()
'----------------------------------------
With Chart.SeriesList
.AddGanttSeries(r("半成品名称"), sat, en)
.AddGanttSeries(r("半成品名称"), sat1, en1)
.AddGanttLabels("M月d日")
End With
vsat.Clear
vend.Clear
vsat1.Clear
vend1.Clear
Next