Dim Chart As WinForm.Chart = e.Form.Controls("Chart4") ' 引用窗口中的图表
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("财务汇总窗口_Table13")
t.Filter = iif(t.filter>"", "(" & t.filter & ")", "1=1") & " And 年份 Is not null"
'For Each c As object In e.Form.Controls
'If Typeof c Is winform.CheckBox Then
'If c.Checked Then
'ls.add(c.Name)
'End If
'End If
'Next
For Each c As object In e.Form.Controls
If Typeof c Is winform.CheckBox Then
If c.Checked AndAlso Tables("财务汇总").Cols.Contains(c.Name) Then
ls.add(c.Name)
End If
End If
Next
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.TooltipText = ls(i) & " : {#YVAL}"
Series.X(r) = r
Series.Y(r) = t.Rows(r)(ls(i))
Next
Next
For r As Integer = 0 To t.Rows.Count - 1
Chart.AxisX.SetValueLabel(r, t.Rows(r)("年份") & "-" &t.Rows(r)("月份")) '指定字符表示
Next
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.East '图列显示在东方(右方)
Chart.AxisX.AnnoWithLabels = True '启用字符标示
'Chart.AxisX.AnnoWithLabels = True '启用字符标示
Chart.VisualEffect = True '加上这一行,让你的图表更漂亮
Chart.LegendVisible = True '显示图列
Chart.AxisX.AnnoRotation = - 45 'X轴标示逆时针旋转45度
Chart.LegendCompass= CompassEnum.South '图列显示在南方(底端)