Dim Chart As WinForm.Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Dim series As winform.ChartSeries
chart.AxisX.Font = new font("宋体", 10) '设置图表字体大小
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.AxisX.ClearValueLabel
Chart.ChartType = ChartTypeEnum.XYPlot
Dim ls As new List(Of String)
Dim t As Table = Tables("窗口1_Table1")
ls.add("金额")
For i As Integer = 0 To ls.Count - 1
Series = Chart.SeriesList.Add() '增加一个图系
Series.Text = ls(i)
Series.Length = t.Rows.count
Dim idx As Integer = 0
For r As Integer = 0 To t.Rows.Count - 1
Series.X(r) = r
Series.Y(r) = t.Rows(r)(ls(i))
Next
Series.TooltipText = "{#YVAL}"
Next
For r As Integer = 0 To t.Rows.Count - 1
'Chart.AxisX.SetValueLabel(r, t.Rows(r)("年份") & "-" &t.Rows(r)("月份")) '指定字符表示
Chart.AxisX.SetValueLabel(r, t.Rows(r)("时间")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)