Foxtable(狐表)用户栏目专家坐堂 → 如何通过代码生成柱状图


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

主题:如何通过代码生成柱状图

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/2/6 16:16:00 [显示全部帖子]

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Chart = e.Form.Controls("Chart2")
Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.Bar
Chart.DataSource = "熔炼效率"
Chart.SeriesList.Clear()
Series = Chart.SeriesList.Add()
Series.Text = "一班熔速"
Series.X.DataField = "铸锭批号"
Series.Y.DataField = "熔炼1_熔速kgph"


或者这样

 

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Chart = e.Form.Controls("Chart2")
Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.Bar
dim t as table = tables("熔炼效率")
Chart.SeriesList.Clear()
Series = Chart.SeriesList.Add()
Series.Text = "一班熔速"
Series.Length = t.Rows.Count '设置图系的长度
For i As Integer = 0 To t.Rows.Count - 1 '指定每个数据点的位置
    Series.X(i) = i '指定水平坐标
    Series.Y(i) = t.Rows(i)("熔炼1_熔速kgph") '指定垂直坐标
    Chart.AxisX.SetValueLabel(i, t.Rows(i)("铸锭批号")) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True

 

[此贴子已经被作者于2018/2/6 16:16:38编辑过]

 回到顶部