以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 图表参数设置请教 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157896) |
-- 作者:ljh29206 -- 发布时间:2020/11/2 8:55:00 -- 图表参数设置请教 请问一下图表 能否 进行 合计数的标记 可否在最顶端添加一个合计数的 标记值 这个参数是什么,帮忙没找到
|
-- 作者:有点蓝 -- 发布时间:2020/11/2 9:54:00 -- 参考:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=118929&skin=0 Dim Chart As WinForm.Chart \'定义一个图表变量 Dim Series As WinForm.ChartSeries \'定义一个图系变量 Dim t As Table = Tables("统计表1") \'定义一个变量t引用数据表 Chart = e.Form.Controls("Chart1") \' 引用窗口中的图表 Chart.ChartType = ChartTypeEnum.Bar \'图表类型改为Bar(条形) Chart.Stacked = True Chart.SeriesList.Clear() \'清除图表原来的图系 For Each c As Col In t.Cols If c.Name <> "产品" Then Series = Chart.SeriesList.Add() \'增加一个图系 Series.Text = c.Name \'设置图系的标题 Series.Length = t.Rows.Count \'设置图系的长度 For r As Integer = 0 To t.Rows.Count - 1 Series.X(r) = r Series.Y(r) = t.Rows(r)(c.Name) Next End If Next \'Series.DataLabelText = "sum({#YVAL)})" For r As Integer = 0 To t.Rows.Count - 1 Chart.AxisX.SetValueLabel(r, t.Rows(r)("产品")) \'指定字符表示 Next Chart.AxisX.AnnoWithLabels = True \'启用字符标示 Chart.VisualEffect = True \'加上这一行,让你的图表更漂亮 Chart.LegendVisible = True \'显示图列 Chart.LegendCompass= CompassEnum.South \'图列显示在南方(底端) Dim c1Chart1 = Chart.basecontrol Dim lbls = c1Chart1.ChartLabels For i As Integer = 1 To t.Cols.count -1 Dim lbl As C1.Win.C1Chart.Label = lbls.LabelsCollection.AddNewLabel() Dim sum As Integer For j As Integer = 0 To t.Rows.Count - 1 sum += t.Rows(j)(i) Next lbl.Text = sum lbl.AttachMethod = C1.Win.C1Chart.AttachMethodEnum.DataIndex lbl.AttachMethodData.GroupIndex = 0 lbl.AttachMethodData.SeriesIndex = t.Cols.Count - 2 lbl.AttachMethodData.PointIndex = i-1 lbl.Style.ForeColor = Color.Red lbl.style.font = new font("宋体", 8) lbl.Compass = LabelCompassEnum.North lbl.Visible = True Next |
-- 作者:ljh29206 -- 发布时间:2020/11/2 10:16:00 -- 蓝版 谢谢 把 统计表1的 数据贴出来看看
|
-- 作者:有点蓝 -- 发布时间:2020/11/2 10:18:00 -- http://www.foxtable.com/webhelp/topics/0970.htm |