Foxtable(狐表)用户栏目专家坐堂 → 图系


  共有2312人关注过本帖树形打印复制链接

主题:图系

帅哥哟,离线,有人找我吗?
cqlistone
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:58 积分:713 威望:0 精华:0 注册:2015/5/11 20:47:00
图系  发帖心情 Post By: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


 回到顶部