Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim t As Table = Tables("ass2014下电子查询表") '定义一个变量t引用数据表
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar '图表类型改为Bar(条形)
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = "大于85"
Series.Length = t.Cols.Count-2 '设置图系的长度
For c As Integer = 2 To t.Cols.Count - 1
Series.X(c-2) = c-2
Series.Y(c-2) = t.DataTable.Compute("count(" & t.Cols(c).name & ")",t.Cols(c).name & "='√' and 总评成绩>=85")
Chart.AxisX.SetValueLabel(c-2,t.Cols(c).name)
Next
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = "75-85"
Series.Length = t.Cols.Count-2 '设置图系的长度
For c As Integer = 2 To t.Cols.Count - 1
Series.X(c-2) = c-2
Series.Y(c-2) = t.DataTable.Compute("count(" & t.Cols(c).name & ")",t.Cols(c).name & "='√' and 总评成绩 >75 and 总评成绩 <85")
Chart.AxisX.SetValueLabel(c-2,t.Cols(c).name)
Next
Chart.AxisX.AnnoRotation=25
'For r As Integer = 0 To t.Rows.Count - 1
'Chart.AxisX.SetValueLabel(r, 111) '指定字符表示
'Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)