以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  窗口中的统计表,无法显示表达式列  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=158129)

--  作者:atropos
--  发布时间:2020/11/9 13:37:00
--  窗口中的统计表,无法显示表达式列

 如图:
根据表统计出对应的表,并增加表达式列,在窗口的TB3 中显示,只有统计结果,没有显示增加的表达式;

代码:
\'总成本分构成分析图

Dim g2 As New GroupTableBuilder("统计表13", DataTables("污水厂运营分析表"))
\'Dim MTXT As WinForm.TextBox = e.Form.Controls("TextBox1")
\'g.Groups.AddDef("厂区编号")
g2.Groups.AddDef("年")
g2.Groups.AddDef("月")
g2.Totals.AddDef("直接运营成本",True)
g2.Totals.AddDef("大修费",True)
g2.Totals.AddDef("折旧费",True)
g2.Totals.AddDef("特许经营权摊销",True)
g2.Totals.AddDef("财务费用",True)
g2.Totals.AddDef("集团服务费",True)
g2.Totals.AddDef("税金及附加",True)
g2.Totals.AddDef("其他成本",True)
g2.Totals.AddDef("总成本小计",True)

g2.Filter = " [月] =  \'" &  MTXT.value  & " \'"  \'按照月份同比统计
g2.Build()

DataTables("统计表13").DataCols.Add("年月",Gettype(String)," [年] +\'-\'+ [月] ")  \'生成一列用来区分不同年和月

DataTables("统计表13").DataCols.Add("直接运营成本占比",Gettype(Double)," ([直接运营成本]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("大修费占比",Gettype(Double)," ([大修费]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("折旧费占比",Gettype(Double)," ([折旧费]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("特许经营权摊销占比",Gettype(Double)," ([特许经营权摊销]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("财务费用占比",Gettype(Double)," ([财务费用]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("集团服务费占比",Gettype(Double)," ([集团服务费]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("税金及附加占比",Gettype(Double)," ([税金及附加]/[总成本小计])") \'生成一列计算百分比
DataTables("统计表13").DataCols.Add("其他成本占比",Gettype(Double)," ([其他成本]/[总成本小计])") \'生成一列计算百分比




For Each c As Col In Tables("运管中心_table3").Cols    \'平均值列设置百分比显示
    If c.Caption = "占比" Then
        c.DataCol.SetFormat("#.00%")
    End If
Next
Tables("运管中心_Table3").DataSource = g2.BuildDataSource()

\'当期各成本占比

Chart = e.Form.Controls("Chart6") \' 引用窗口中的图表
Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮
Chart.ChartType = ChartTypeEnum.Pie     \'图表类型该为Bar(条形)
\'Chart.ChartType2 = ChartTypeEnum.XYPlot \'图表类型该为Bar(ChartTypeEnum.XYPlot条形)

Chart.DataSource = "统计表13" \'设置绑定表
Chart.SeriesList.Clear() \'清除图表原来的图系

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "直接运营成本占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "直接运营成本占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "大修费占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "大修费占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "折旧费占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "折旧费占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "特许经营权摊销占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "特许经营权摊销占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "财务费用占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "财务费用占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "集团服务费占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "集团服务费占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "税金及附加占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "税金及附加占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"

Series = Chart.SeriesList.Add() \'增加第一个图系
Series.Text = "其他成本占比"
Series.X.DataField = "年月" \'X轴绑定到产品列
Series.Y.DataField = "其他成本占比" \'Y轴绑定到数量列
Series.DataLabelText = "{#YVAL:0%}"



Chart.LegendVisible = True \'显示图列
Chart.LegendCompass= CompassEnum.East \'图列显示在南方(底端)

显示:


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20201109133356.png
图片点击可在新窗口打开查看

表达式列无法显示,同时,图表中需要同时显示 数值+百分比,应该怎么做呢?
请老师帮忙看一下,谢谢。


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20201109161408.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2020/11/9 16:14:26编辑过]