Dim d As Date =Date.Today
Dim sd As WinForm.DateTimePicker = e.Form.Controls("StartDate")
Dim ed As WinForm.DateTimePicker = e.Form.Controls("EndDate")
ed.value=d.AddDays(-1)
sd.value=d.AddDays(-7)
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim tbl As DataTable = DataTables("订单财务明细") '定义一个变量tbl引用数据表
Dim lst As List(Of String) = tbl.GetValues("交易时间","[交易时间]>=#" & sd.Value & "# And [交易时间]<=#" & ed.Value & "# ) '获得交易时间集合
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.Length = lst.Count '设置图系的长度
Chart.ChartType = ChartTypeEnum.Bar
Chart.AxisX.DateType = True 'X轴是日期型
Series.TooltipText = "费用 =¥ {#YVAL}"
For i As Integer = 0 To lst.Count - 1 '指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = tbl.Compute("Sum(原价)","[交易时间] = '" & lst(i) & "'") '指定垂直坐标
Chart.AxisX.SetValueLabel(i,Format(cdate(lst(i)),"dddd")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示