以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 圆饼图表生成 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=123959) |
||||
-- 作者:yangwenghd -- 发布时间:2018/8/27 22:33:00 -- 圆饼图表生成
请教一下老师, 计算总量可以是在不添加新表或者临时表情况下,把计算总数量设置为不同表不同列的和吗?感谢 感谢 产品名称用表的名称可以吗?感谢 感谢 Dim Chart
As WinForm.Chart
\'定义一个图表变量 就是数量的部分可以是几个表指定的某列后行吗? 比如这个图表 的计算总量为 表 支出汇总的支出金额 的支出编号的最后一行的支出金额 加 表负载汇总 的欠款编号最后一行的 欠款金额 加 经营 汇总 的经营编号 最后一行 的变动金额 列 ,这上个数据总和为计算总量, [此贴子已经被作者于2018/8/27 22:34:09编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2018/8/27 23:09:00 -- Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= Forms("图表学习2").Controls("Chart1") \' 引用窗口中的图表 Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮 Chart.ChartType = ChartTypeEnum.Pie \'图表1类型改为Bar(条形) Dim nms() As String = {"支出汇总","经营汇总","负载汇总"} Dim nms2() As String = {"支出金额","变动金额","欠款金额"} Dim sum As Double = 0 For i As Integer = 0 To nms.Length - 1 sum += Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Next For i As Integer = 0 To nms.Length - 1 Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 1 \'一个系列只能包括一个值 Series.Text = nms(i) Dim cnt = Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Series.Y(0) = cnt Series.DataLabelText = Math.Round(cnt*100/sum ,2) & "%" Next Chart.LegendVisible = True \'显示图列 Chart.LegendCompass= CompassEnum.East \'图列显示在东方(右方)
|
||||
-- 作者:yangwenghd -- 发布时间:2018/8/28 0:07:00 -- 太感谢 了 太感谢了, 就是总数量可以是各个表最后一行的和吗?不是整列, 就只是最后一行,比如 支出汇总 的最后一行就是 支出编号列的最后一行 20180826231902 ,对于的 支出金额 就是30,其它两个表也是一样,前面的不管他,只是计算最后一行,感谢 感谢 |
||||
-- 作者:有点甜 -- 发布时间:2018/8/28 9:28:00 -- Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= Forms("图表学习2").Controls("Chart1") \' 引用窗口中的图表 Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮 Chart.ChartType = ChartTypeEnum.Pie \'图表1类型改为Bar(条形) Dim nms() As String = {"支出汇总","经营汇总","负载汇总"} Dim nms2() As String = {"支出金额","变动金额","欠款金额"} Dim sum As Double = 0 For i As Integer = 0 To nms.Length - 1 Dim r As Row = Tables(nms(i)).Rows(Tables(nms(i)).count-1) Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 1 \'一个系列只能包括一个值 Series.Text = nms(i) & "(" & r(nms2(i)) & ")" Series.Y(0) = r(nms2(i)) Series.DataLabelText = r(nms2(i)) Next Chart.LegendVisible = True \'显示图列 Chart.LegendCompass= CompassEnum.East \'图列显示在东方(右方) |
||||
-- 作者:yangwenghd -- 发布时间:2018/8/28 15:03:00 -- 能在请教一下红色和蓝色的代码吗? 蓝色部分是 表对应的列的和,红色为 表对应列的最后一行,感谢 感谢 我想把2楼和4楼的组合起来,感谢 感谢 Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= Forms("财务汇总窗口").Controls("Chart5") \' 引用窗口中的图表 Chart.SeriesList.Clear() \'清除图表原来的图系 Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮 Chart.ChartType = ChartTypeEnum.Pie \'图表1类型改为Bar(条形) Dim nms() As String = {"企业档案","投资资产","现金明细","供应系统","欠款明细"} Dim nms2() As String = {"财务_待收款","资产时态_在投资金","可控金额","未支付合计","欠款合计"} Dim nms3() As String = {"现金明细","欠款明细"} Dim nms4() As String = {"可控金额","欠款合计"} Dim sum As Double = 0 For i As Integer = 0 To nms.Length - 1 sum += Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Next For i As Integer = 0 To nms.Length - 1 Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 1 \'一个系列只能包括一个值 Series.Text = nms(i) Dim cnt = Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Series.Y(0) = cnt Series.DataLabelText = Math.Round(cnt*100/sum ,2) & "%" Next Chart.LegendVisible = True \'显示图列 Chart.LegendCompass= CompassEnum.East \'图列显示在东方(右方) |
||||
-- 作者:有点甜 -- 发布时间:2018/8/28 15:05:00 -- 上传具体实例测试。 |
||||
-- 作者:有点甜 -- 发布时间:2018/8/28 15:11:00 -- Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Chart= Forms("财务汇总窗口").Controls("Chart5") \' 引用窗口中的图表 Chart.SeriesList.Clear() \'清除图表原来的图系 Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮 Chart.ChartType = ChartTypeEnum.Pie \'图表1类型改为Bar(条形) Dim nms() As String = {"企业档案","投资资产","现金明细","供应系统","欠款明细"} Dim nms2() As String = {"财务_待收款","资产时态_在投资金","可控金额","未支付合计","欠款合计"} Dim nms3() As String = {"现金明细","欠款明细"} Dim nms4() As String = {"可控金额","欠款合计"} Dim sum As Double = 0 For i As Integer = 0 To nms.Length - 1 sum += Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Next For i As Integer = 0 To nms.Length - 1 Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 1 \'一个系列只能包括一个值 Series.Text = nms(i) Dim cnt = Tables(nms(i)).Compute("sum(" & nms2(i) & ")") Series.Y(0) = cnt Series.DataLabelText = Math.Round(cnt*100/sum ,2) & "%" Next For i As Integer = 0 To nms3.Length - 1 Dim r As Row = Tables(nms3(i)).Rows(Tables(nms3(i)).count-1) Series = Chart.SeriesList.Add() \'增加一个图系 Series.Length = 1 \'一个系列只能包括一个值 Series.Text = nms3(i) & "(" & r(nms4(i)) & ")" Series.Y(0) = r(nms4(i)) Series.DataLabelText = r(nms4(i)) Next Chart.LegendVisible = True \'显示图列 Chart.LegendCompass= CompassEnum.East \'图列显示在东方(右方) |
||||
-- 作者:yangwenghd -- 发布时间:2018/8/28 16:31:00 -- 能再帮忙教学一下吗?感谢 太感谢了,太感谢了, 如果总和是 某列相同的最后一行合应该怎么写呀? 比如 总和是 按下面代码算出的 ,相对于吧 下面代码转为为图表,感谢 感谢 Select Case e.DataCol.Name Case "债权人","借款金额","还款金额" Dim drs As List(of DataRow) Dim Filter As String Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [债权人] = \'" & e.DataRow("债权人") & "\'" drs = e.DataTable.Select(Filter) For Each dr As DataRow In drs Filter = "[_SortKey] <= " & dr("_SortKey") & " And [债权人] = \'" & dr("债权人") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(借款金额)",Filter) Dim Val2 As Double = e.DataTable.Compute("Sum(还款金额)",Filter) dr("欠款明细") = Val1 - Val2 Next If e.DataCol.Name = "债权人" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [债权人] = \'" & e.OldValue & "\'" drs = e.DataTable.Select(Filter) For Each dr As DataRow In drs Filter = "[_SortKey] <= " & dr("_SortKey") & " And [债权人] = \'" & dr("债权人") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(借款金额)",Filter) Dim Val2 As Double = e.DataTable.Compute("Sum(还款金额)",Filter) dr("欠款明细") = Val1 - Val2 Next End If End Select \'求欠款明细 |
||||
-- 作者:有点甜 -- 发布时间:2018/8/28 16:34:00 -- 上传具体项目说明你的问题。 |
||||
-- 作者:yangwenghd -- 发布时间:2018/8/28 17:21:00 --
感谢 感谢 总和为第一列相同行的最后一行的第二列,比如目前的表就是A,4+B,7+C,7 |