以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 图表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74268)
|
-- 作者:cqlistone
-- 发布时间: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
|
-- 作者:大红袍
-- 发布时间:2015/9/7 14:55:00
--
[此贴子已经被作者于2015/9/7 14:56:55编辑过]
|
-- 作者:大红袍
-- 发布时间: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
-- 发布时间:2015/9/7 19:36:00
--
你好!
|
-- 作者:大红袍
-- 发布时间: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
-- 发布时间: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)
|
-- 作者:大红袍
-- 发布时间: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
|