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


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

主题:图表

美女呀,离线,留言给我吧!
bm
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:437 积分:3463 威望:0 精华:0 注册:2011/9/13 23:27:00
图表  发帖心情 Post By:2015/1/14 23:16:00 [只看该作者]

Dim bd1 As New GroupTableBuilder("统计",DataTables("账户"))
Dim dt1 As fxDataSource
bd1.FromServer = True
bd1.Groups.AddDef("账户名称")
bd1.Totals.AddDef("初始金额")
dt1 = bd1.BuildDataSource()

Dim bd2 As New GroupTableBuilder("统计表2",DataTables("流水账"))
Dim dt2  As fxDataSource
bd2.Filter = "[类别] ='支出' "
bd2.FromServer = True
bd2.Groups.AddDef("账户名称")
bd2.Totals.AddDef("金额","支出金额")
dt2 = bd2.BuildDataSource()

Dim bd3 As New GroupTableBuilder("统计表3",DataTables("流水账"))
Dim dt3 As fxDataSource
bd3.Filter = "[类别] = '收入'"
bd3.FromServer = True
bd3.Groups.AddDef("账户名称")
bd3.Totals.AddDef("金额","收入金额")
dt3 = bd3.BuildDataSource()

dt1.Combine("账户名称",dt2,"账户名称")
dt1.Combine("账户名称",dt3,"账户名称")
dt1.Show("统计")
DataTables("统计").DataCols.Add("余额",Gettype(Double),"( IIF( 初始金额 Is null,0,初始金额) -IIF( 支出金额 Is null,0, 支出金额) + IIF(收入金额 Is Null,0,收入金额))")

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries
Dim t As Table = Tables("统计")
Dim sm As Integer = t.Compute("Sum(余额)") '计算总数量
Chart= e.Form.Controls("Chart1")
Chart.SeriesList.Clear()
Chart.VisualEffect = True
Chart.ChartType = ChartTypeEnum.Pie
For Each r As Row In t.Rows
  If r("余额") <> 0 Then
    Series = Chart.SeriesList.Add()
    Series.Length = 1
    Series.Text = r("账户名称") & "(" & r("余额") & ")"
    Series.Y(0) = r("余额")
    Series.DataLabelText = Math.Round(r("余额")*100/sm,2) & "%"
 End If
Next

Chart.LegendVisible = True '显示图列
Chart.LegendCompass= CompassEnum.East
RibbonMenu.StatusBar.Message3 = "余额:" & " " &  DataTables("统计").Compute("Sum(余额)")

 

 

麻烦帮忙上面Pie 的图表改成Bar


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


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2015/1/15 8:05:00 [只看该作者]

Chart.ChartType = ChartTypeEnum.Pie 
Chart.ChartType = ChartTypeEnum.Bar 



 回到顶部