Dim Chart As WinForm.Chart '定义一个图表变量 Dim Series As WinForm.ChartSeries '定义一个图系变量 Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表 Chart.SeriesList.Clear() '清除图表原来的图系 Series = Chart.SeriesList.Add() '增加一个图系 'Dim t As Table = Tables("子公司业绩") '定义一个变量t引用数据表 Dim drs As List(of DataRow) If DataTables("进货记录").find("[代理商编号] = '" & cdbh & "'") IsNot Nothing Then drs = DataTables("进货记录").Select("[代理商编号] = '"& cdbh &"'", "结算日期") Series.Length = drs.count Dim i As Integer = 0 For Each dr As DataRow In drs Series.X(i) = i Series.Y(i) = dr("进货额") Chart.AxisX.SetValueLabel(i, dr("结算日期")) '指定字符表示 i = i + 1 Next Chart.AxisX.AnnoWithLabels = True '启用字符标示 Else MessageBox.Show("没有这个企业代码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error) End If
|