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


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

主题:图表问题

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/25 15:02:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目162.rar


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/25 16:15:00 [显示全部帖子]

当然可以啊,统计不是可以设置条件的吗?

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/26 10:10:00 [显示全部帖子]

加粗的一行,解决筛选问题。

 

 

Dim Chart As WinForm.Chart = e.Form.Controls("Chart1")
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("下单"))
g.Groups.AddDef("材质")
g.Totals.AddDef("裂纹", AggregateEnum.Count)
g.Totals.AddDef("旧角",AggregateEnum.Count)
g.Totals.AddDef("起层",AggregateEnum.Count)
g.Totals.AddDef("不严",AggregateEnum.Count)
g.Totals.AddDef("尺差",AggregateEnum.Count)
g.Totals.AddDef("偏稍",AggregateEnum.Count)
g.Totals.AddDef("粘板",AggregateEnum.Count)
g.Totals.AddDef("其它",AggregateEnum.Count)
g.Filter = Tables("下单").Filter
dt = g.Build(True)

Chart.VisualEffect = True
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.ChartType = ChartTypeEnum.Bar '设置图表类型
Chart.Stacked = True
Chart.SeriesList2.Clear() '清除图表原来的图系
Dim nms() As String = {"裂纹","旧角","起层","不严","尺差","偏稍","粘板","其它"}
Dim vls(7) As Double
Dim Series As WinForm.ChartSeries '定义一个图系变量
For n As Integer = 0 To 7
    Series = Chart.SeriesList.Add() '增加一个图系
    Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
    Series.Text = nms(n)
    For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
        Series.X(i) = i '指定水平坐标
        Series.Y(i) = dt.DataRows(i)(nms(n)) '指定垂直坐标
        vls(n) = vls(n) + dt.DataRows(i)(nms(n))
    Next
Next
For n As Integer = 0 To 7
    Series = Chart.SeriesList2.Add() '增加一个图系
    Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
    Series.Text = nms(n)
    For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
        Series.X(i) = i '指定水平坐标
        Series.Y(i) = dt.DataRows(i)(nms(n)) / vls(n)
    Next
Next
For r As Integer = 0 To dt.dataRows.Count - 1
    Chart.AxisX.SetValueLabel(r, dt.dataRows(r)("材质")) '指定字符表示
Next

[此贴子已经被作者于2011-10-26 10:10:13编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/26 11:30:00 [显示全部帖子]

Dim Chart As WinForm.Chart = e.Form.Controls("Chart1")
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("下单"))
g.Groups.AddDef("材质")
g.Totals.AddDef("裂纹", AggregateEnum.Count)
g.Totals.AddDef("旧角",AggregateEnum.Count)
g.Totals.AddDef("起层",AggregateEnum.Count)
g.Totals.AddDef("不严",AggregateEnum.Count)
g.Totals.AddDef("尺差",AggregateEnum.Count)
g.Totals.AddDef("偏稍",AggregateEnum.Count)
g.Totals.AddDef("粘板",AggregateEnum.Count)
g.Totals.AddDef("其它",AggregateEnum.Count)
g.Filter = Tables("下单").Filter
dt = g.Build(True)

Chart.VisualEffect = True
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.ChartType = ChartTypeEnum.Bar '设置图表类型
Chart.Stacked = True
Chart.SeriesList2.Clear() '清除图表原来的图系
Dim nms() As String = {"裂纹","旧角","起层","不严","尺差","偏稍","粘板","其它"}
Dim vls As Double
Dim Series As WinForm.ChartSeries '定义一个图系变量
For n As Integer = 0 To 7
    Series = Chart.SeriesList.Add() '增加一个图系
    Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
    Series.Text = nms(n)
    For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
        Series.X(i) = i '指定水平坐标
        Series.Y(i) = dt.DataRows(i)(nms(n)) '指定垂直坐标
        vls = vls + dt.DataRows(i)(nms(n))
    Next
Next
For n As Integer = 0 To 7
    Series = Chart.SeriesList2.Add() '增加一个图系
    Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
    Series.Text = nms(n)
    For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
        Series.X(i) = i '指定水平坐标
        Series.Y(i) = dt.DataRows(i)(nms(n)) / vls
    Next
Next
For r As Integer = 0 To dt.dataRows.Count - 1
    Chart.AxisX.SetValueLabel(r, dt.dataRows(r)("材质")) '指定字符表示
Next

 


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/10/26 14:58:00 [显示全部帖子]

Dim Chart As WinForm.Chart = e.Form.Controls("Chart1")
Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("下单"))
g.Groups.AddDef("材质")
g.Totals.AddDef("裂纹", AggregateEnum.Count)
g.Totals.AddDef("旧角",AggregateEnum.Count)
g.Totals.AddDef("起层",AggregateEnum.Count)
g.Totals.AddDef("不严",AggregateEnum.Count)
g.Totals.AddDef("尺差",AggregateEnum.Count)
g.Totals.AddDef("偏稍",AggregateEnum.Count)
g.Totals.AddDef("粘板",AggregateEnum.Count)
g.Totals.AddDef("其它",AggregateEnum.Count)
g.Filter = Tables("下单").Filter
dt = g.Build(True)

Chart.VisualEffect = True
Chart.SeriesList.Clear() '清除图表原来的图系
Chart.ChartType = ChartTypeEnum.Bar '设置图表类型
Chart.Stacked = True
Chart.SeriesList2.Clear() '清除图表原来的图系
Dim nms() As String = {"裂纹","旧角","起层","不严","尺差","偏稍","粘板","其它"}
Dim vls As Double
Dim Series As WinForm.ChartSeries '定义一个图系变量
For n As Integer = 0 To 7
    Series = Chart.SeriesList.Add() '增加一个图系
    Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
    Series.Text = nms(n)
    For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
        Series.X(i) = i '指定水平坐标
        Series.Y(i) = dt.DataRows(i)(nms(n)) '指定垂直坐标
        vls = vls + dt.DataRows(i)(nms(n))
    Next
Next
Series = Chart.SeriesList2.Add() '增加一个图系
Series.Length = dt.DataRows.Count '图系的数据点数等于表的行数
Series.Text = "比例"
For i As Integer = 0 To dt.DataRows.Count - 1 '指定每个数据点的位置
    Series.X(i) = i '指定水平坐标
    Dim v As Double = 0
    For Each nm As String In nms
        v = v +  dt.DataRows(i)(nm)
    Next
    Series.Y(i) = v / vls
Next
For r As Integer = 0 To dt.dataRows.Count - 1
    Chart.AxisX.SetValueLabel(r, dt.dataRows(r)("材质")) '指定字符表示
Next


 回到顶部