以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  图系  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=83690)

--  作者:cqlistone
--  发布时间:2016/4/14 16:47:00
--  图系

你好!

取列3的文本作为X轴,Y轴值=列4 /列1,请帮忙改下Y轴代码

 

 

Dim Chart As WinForm.Chart \'定义一个图表变量
Dim Series As WinForm.ChartSeries \'定义一个图系变量
Dim tblr As DataTable = DataTables("表A") \'定义一个变量tbl引用数据表
Dim lst As List(Of String) = tblr.SQLGetValues("列3","[列2] = \'" & e.Form.Controls("TreeView3").SelectedNode.name &  "\' and 列2 is not null")\'获得产品名称集合
Chart = e.Form.Controls("Chart1") \' 引用窗口中的图表
Chart.ChartType = ChartTypeEnum.Bar \'设置图表类型
Chart.SeriesList.Clear() \'清除图表原来的图系
Chart.AxisX.ClearValueLabel                 \'清除图表原来的水平坐标
Series = Chart.SeriesList.Add() \'增加一个图系
Series.Length = lst.Count \'设置图系的长度

For ii As Integer = 0 To lst.Count - 1 \'指定每个数据点的位置
Dim r1 As Single = tblr.SQLCompute("SUM(列1)","[列2] = \'" & e.Form.Controls("TreeView3").SelectedNode.name &  "\'and [列3] = \'" & lst(ii) & "\' and 列2 is not null and 列1 is not null")
Dim r2 As Single = tblr.SQLCompute("SUM(列4)","[列2] = \'" & e.Form.Controls("TreeView3").SelectedNode.name &  "\'and [列3] = \'" & lst(ii) & "\' and 列2 is not null and 非列1 is not null")
Dim qq1B() As Single = {r1}
Dim qq2B() As Single = {r2}
Dim r() As Single = qq2B() / qq1B()
 Series.X(ii) = ii \'指定水平坐标
    Series.Y(ii) = r(ii)


 Chart.AxisX.SetValueLabel(ii, lst(ii)) \'指定字符表示
Next
Chart.HeaderText="增值与非增值比率"   \'设置图表的上标题
Chart.AxisX.AnnoWithLabels = True \'启用字符标示
Series.DataLabelText = "{#YVAL}"    \'图中显示数据
Chart.VisualEffect = True           \'图更漂亮
Chart.SeriesList(0).LineColor= Color.MediumBlue


--  作者:大红袍
--  发布时间:2016/4/14 16:49:00
--  
Series.Y(ii) = r2 / r1