Foxtable(狐表)用户栏目专家坐堂 → 图表


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

主题:图表

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


加好友 发短信
等级:婴狐 帖子:58 积分:713 威望:0 精华:0 注册:2015/5/11 20:47:00
图表  发帖心情 Post By:2015/9/7 14:51:00 [只看该作者]

你好!

帮我看看什么错误

“派工耗时,待修耗时,维修耗时,待检耗时,检验耗时, 申请日期”是表A的列名。

图表X轴是 “派工耗时,待修耗时,维修耗时,待检耗时,检验耗时 ”的列名

Y轴是“派工耗时,待修耗时,维修耗时,待检耗时,检验耗时 ”对应列数据的平均值

 

 

Dim Chart As WinForm.Chart                                                                                                                                  
Dim Series As WinForm.ChartSeries                                                                                                                      
Dim t As DataTable =  DataTables(“A")                                                                                                           
Chart = e.Form.Controls("Chart1")                                                                                                                        
Chart.ChartType = ChartTypeEnum.Bar                                                                                                               
Chart.SeriesList.Clear()
                                                                                                                                            


For Each c As dataCol in t.dataCols
    If c.Name
= “派工耗时,待修耗时,维修耗时,待检耗时,检验耗时Then
        Series = Chart.SeriesList.Add
()                                                                                                                        
       
Series.Text = c.Name                                                                                                                                        
       
Series.Length = t.Rows.Count                                                                                                                          
       
For r As Integer = 0 To t.Rows.Count - 1
            Series.X(r) =
r
           
Series.Y(r) = t.Compute(“Avg(c.Name)”,“[申请日期] = '" & t(r) & "'")                                             
        Next
    End If
Next
For r As Integer = 0 to t.Rows.Count - 1
    Chart.AxisX.SetValueLabel(r, t.Rows(r
)(“c.Name"))                                                                                            
Next


Chart.AxisX.AnnoWithLabels =
True                                                                                                                       
Chart.VisualEffect = True                                                                                                                                        
Chart.LegendVisible = True
Chart.LegendCompass= CompassEnum.South                                                                                                         


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


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

 

[此贴子已经被作者于2015/9/7 14:56:55编辑过]

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


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

看不懂你什么意思,请上传具体例子

 

For Each c As DataCol In t.dataCols
    Select Case c.Name
        Case "派工耗时,待修耗时,维修耗时,待检耗时,检验耗时"
            Series = Chart.SeriesList.Add()
            Series.Text = c.Name
            Series.Length = t.Rows.Count
            For r As Integer = 0 To t.Rows.Count - 1
                Series.X(r) = r
                Series.Y(r) = val(t.Compute("Avg(" & c.Name & ")","[申请日期] = '" & t(r) & "'"))
            Next
    End Select
Next
For r As Integer = 0 To t.Rows.Count - 1
    Chart.AxisX.SetValueLabel(r, t.Rows(r)("申请日期"))                                                                                            
Next


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


加好友 发短信
等级:婴狐 帖子:58 积分:713 威望:0 精华:0 注册:2015/5/11 20:47:00
  发帖心情 Post By:2015/9/7 19:36:00 [只看该作者]

你好!
例子
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:测试.zip


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


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

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Dim t As Table =  Tables("停机处置")
Chart = Forms("报表").Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Bar
Chart.SeriesList.Clear()


For Each c As Col In t.cols
    Select Case c.Name
        Case "待派工耗时M","待维修耗时M","维修耗时M","待检验耗时M","检验耗时M","处置停机总耗时M"
            Series = Chart.SeriesList.Add()
            Series.Text = c.Name
            Series.Length = 12
            For i As Integer = 0 To 11
                Dim d As Date = new Date(Date.Today.Year, i+1, 1)
                Series.X(i) = i
                Series.Y(i) = val(t.Compute("Avg(" & c.Name & ")", "申请时间 >= #" & d & "# and 申请时间 < #" & d.AddMonths(1) & "#"))
                Chart.AxisX.SetValueLabel(i, Format(d, "yyyy-MM"))
            Next
    End Select
Next


Chart.AxisX.AnnoWithLabels = True
Chart.VisualEffect = True
Chart.LegendVisible = True
Chart.LegendCompass= CompassEnum.South


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


加好友 发短信
等级:婴狐 帖子:58 积分:713 威望:0 精华:0 注册:2015/5/11 20:47:00
  发帖心情 Post By:2015/9/8 16:14:00 [只看该作者]

你好!

上面代码X轴显示的是一年12个月的统计信息,如果X轴要显示12个月的信息并且每增加一个月,月份是向后连续递减的怎么编写,

如:

目前是9月

X轴为 即本月、上月....(2015-09、2015-08、2015-07、2015-06、...... 2014-11、2014-10)

如果到了10月

X轴为 即本月、上月....(2015-10、2015-09、2015-08、2015-07、...... 2014-12、2014-11)


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


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

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Dim t As Table =  Tables("停机处置")
Chart = Forms("报表").Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Bar
Chart.SeriesList.Clear()
Chart.AxisX.ClearValueLabel

For Each c As Col In t.cols
    Select Case c.Name
        Case "待派工耗时M","待维修耗时M","维修耗时M","待检验耗时M","检验耗时M","处置停机总耗时M"
            Series = Chart.SeriesList.Add()
            Series.Text = c.Name
            Series.Length = 12
            Dim td As Date = new Date(Date.Today.Year, Date.Today.Month, 1)
            For i As Integer = 0 To 11
                Dim d = td.AddMonths(-i)
                Series.X(i) = i
                Series.Y(i) = val(t.Compute("Avg(" & c.Name & ")", "申请时间 >= #" & d & "# and 申请时间 < #" & d.AddMonths(1) & "#"))
                Chart.AxisX.SetValueLabel(i, Format(d, "yyyy-MM"))
            Next
    End Select
Next

Chart.AxisX.AnnoWithLabels = True
Chart.VisualEffect = True
Chart.LegendVisible = True
Chart.LegendCompass= CompassEnum.South

 


 回到顶部