Foxtable(狐表)用户栏目专家坐堂 → [求助]筛选后生成图表


  共有2667人关注过本帖树形打印复制链接

主题:[求助]筛选后生成图表

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/11 18:00:00 [显示全部帖子]

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

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/11 18:38:00 [显示全部帖子]

1、看懂代码加上你自己的条件;

 

2、没看懂你的意思,你要做到什么效果?

 

3、筛选filter改成tables("表A").Filter


 回到顶部