这样?
'------------------------------筛选条件-------------------------------
Dim Filter As String
With e.Form.Controls("产品组")
If .Value IsNot Nothing Then
Filter = "培训_产品组1 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "培训_时间1 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "培训_时间1 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("学员基础信息").Filter = Filter
End If
'------------------------------------生成统计表------------------------
Dim s1,flt1 As String
Dim dt As DataTable =DataTables("学员基础信息")
s1 = e.Form.Controls("产品组").value
If DataTables.Contains("统计") '如果存在统计表
DataTables.Delete("统计") '则删除之
End If
Dim dtb As New DataTableBuilder("统计")
dtb.AddDef(
"产品组" , Gettype(String), 32)
dtb.AddDef("MIN", Gettype(Integer))
dtb.AddDef("MAX", Gettype(Integer))
dtb.Build()
Dim t As Table =Tables("统计")
t.AddNew(4)
For Each r As Row In t.Rows
r(
"产品组" ) ="Pretest,PostTest,RolePlay,PPT".split(",")(r.Index)
flt1 ="ITC_ITC1_" & r(
"产品组")
r("MIN") = dt.Compute("Min(" & flt1 & ")",Filter)
r("MAX") = dt.Compute("MAX(" & flt1 & ")",Filter)
Next
'-------------------------------------生成图表---------------------------
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.DataSource = "统计" '设置绑定表
chart.Stacked = True
For Each c As Col In t.Cols
If c.Name <>
"产品组" Then
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = c.Name '设置图系的标题
Series.X.DataField =
"产品组" 'X轴绑定到产品列
Series.Y.DataField = c.Name '设置Y轴的绑定列
Series.DataLabelText = "{#YVAL}"
End If
Next
'Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
[此贴子已经被作者于2013-3-25 16:31:16编辑过]