此主题相关图片如下:12.png
怎么解决y数字不是从小到大 从底部往顶部排序呢?
怎么为什么会出现两个15呢?数值相同就只显示一个 然后柱形图中对应的相等即可
'生成Excel报表
Dim b As New XLS.Book
Dim t As Table = Tables("表A")
Dim s As XLS.Sheet = b.Sheets(0)
For c As Integer = 0 To t.Cols.Count -1 '添加列标题
s(0, c).Value = t.Cols(c).Name
Next
For r As Integer = 0 To t.Rows.Count - 1 '填入数据
For c As Integer = 0 To t.Cols.Count -1
s(r +1, c).Value = t.rows(r)(c)
Next
Next
'生成图表
Dim Chart As New ChartBuilder '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Chart.DataSource = "表A" '设置绑定表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Series.X.DataField = "第一列" 'X轴绑定到产品列
Series.Y.DataField = "第二列" 'Y轴绑定到数量列
Chart.PrintWidth = 120
Chart.PrintHeight = 60
s(t.rows.Count + 2,1).Value = New XLS.Picture(Chart.Image)
b.Save("c:\reports\test.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()