Foxtable(狐表)用户栏目专家坐堂 → 求教生成甘特图


  共有3542人关注过本帖平板打印复制链接

主题:求教生成甘特图

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/8/2 19:34:00 [只看该作者]

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 Forms("设计分配按人筛选").Controls("设计人员")
    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
            With Chart.SeriesList
                If dr("设计3D_担当") = dr("设计2D_担当") Then
                    Dim d1,d2,d3,d4 As Date
                    d1 = dr("设计3D_计划开始日期")
                    d2 = dr("设计3D_计划结束日期")
                    d3 = dr("设计2D_计划开始日期")
                    d4 = dr("设计2D_计划结束日期")
                    If d4 <= d1 Then
                        .AddGanttSeries(dr("治具规格"),New DateTime() {d1, d2},New DateTime() {d3, d4})
                    ElseIf d3 >= d2 Then
                        .AddGanttSeries(dr("治具规格"),New DateTime() {d1, d2},New DateTime() {d3, d4})
                    ElseIf d3 < d1 AndAlso d4 > d2 Then
                        .AddGanttSeries(dr("治具规格"),d3, d4)
                    ElseIf d3 < d1 AndAlso d4 < d2 Then
                        .AddGanttSeries(dr("治具规格"),d3, d2)
                    ElseIf d3 > d1 AndAlso d4 > d2 Then
                        .AddGanttSeries(dr("治具规格"),d1, d4)
                    Else
                        .AddGanttSeries(dr("治具规格"),d1, d2)
                    End If
                Else
                    Dim d1, d2 As Date
                    If dr("设计3D_担当") = Forms("设计分配按人筛选").Controls("设计人员").value Then
                        d1 = dr("设计3D_计划开始日期")
                        d2 = dr("设计3D_计划结束日期")
                    Else
                        d1 = dr("设计2D_计划开始日期")
                        d2 = dr("设计2D_计划结束日期")
                    End If
                    .AddGanttSeries(dr("治具规格"),d1, d2)
                End If
                '.AddGanttLabels("M月d日")
            End With
        Next
    End If
End With

 回到顶部
总数 16 1 2 下一页