Dim bd1 As New GroupTableBuilder("统计表1",DataTables("采购明细表"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("采购日期") '根据日期分组
bd1.Totals.AddDef("金额","进货_金额") '对金额进行统计
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("出库"))
Dim dt2
As fxDataSource
bd2.Groups.AddDef("出库日期") '根据日期分组
bd2.Totals.AddDef("金额","销售_金额") '对金额进行统计
dt2 = bd2.BuildDataSource()
dt1.Combine("采购日期",dt2,"出库日期") '将采购统计数据组合到出库统计数据
Tables("窗口1_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("窗口1_Table1").DataCols '用表达式列计算库存数据
.Add("库存_金额",Gettype(Double), "[库存_数量] /[进货_数量] * [进货_金额]")
End With
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart= e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.DataSource = " Tables("窗口1_Table1")" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.X.DataField = "月份" 'X轴绑定到月份列
Series.Y.DataField = "进货金额" 'Y轴绑定到金额列
Series.Y.DataField = "出库金额" 'Y轴绑定到金额列
上述代码:目的在一体图表中表现两个折线,可行吗?关键是最后两行代码,谢谢,请指点