以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 图表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=109156) |
||||
-- 作者:cqli -- 发布时间:2017/11/6 8:36:00 -- 图表 你好 目的是按给定的时间段和 NumericComboBox1里填入的数字(数字代表前几位,比如5则显示出现次数最多的前5位设备的信息)生成图表。怎么写前几位代码? Dim mc As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1") Dim Chart As WinForm.Chart Dim Series As WinForm.ChartSeries Dim t As DataTable = DataTables("设备维修单") Dim pds As List(of String) = t.SQLGetValues("设备编号","[日期] > = \'" & sqrq.value & " \' And [日期] < = \' " & zzrq.value & "\'") Dim sm As Integer = t.SQLCompute("Count(设备编号)","[日期] > = \'" & sqrq.value & " \' And [日期] < = \' " & zzrq.value & "\'") Chart= e.Form.Controls("Chart1") Chart.SeriesList.Clear() Chart.AxisX.ClearValueLabel Chart.VisualEffect = True Chart.ChartType = ChartTypeEnum.Pie For i As Integer = 0 To pds.Count - 1 Series = Chart.SeriesList.Add() Series.Length = 1 Dim pdt = val(t.SQLCompute("Count(设备编号)", "设备编号 = \'" & pds(i) & "\' and [日期] > = \'" & sqrq.value & " \' And [日期] < = \' " & zzrq.value & "\'")) Series.Text = pds(i) & "(" & pdt & ")" Series.Y(0) = pdt Series.DataLabelText = Math.Round(pdt * 100 / sm,1) & "%" Next |
||||
-- 作者:有点甜 -- 发布时间:2017/11/6 9:31:00 -- 先进行分组统计得到表格,或者执行sql语句得到临时表
cmd.commandText = "select top 5 设备编号, count(*) as 次数 from {设备维修单} where [日期] >= \'" & sqrq.value & "\' And [日期] <= \'" & zzrq.value & "\' group by 设备编号 order by count(*)"
http://www.foxtable.com/webhelp/scr/0696.htm
然后根据临时表dt的值,赋值给你的图表 |
||||
-- 作者:cqli -- 发布时间:2017/11/6 15:20:00 -- 弄不出来,帮忙写下代码。谢谢! |
||||
-- 作者:有点甜 -- 发布时间:2017/11/6 15:22:00 -- 如果不会写,那就先生成分组统计表,然后排序,取前五个数据
http://www.foxtable.com/webhelp/scr/0158.htm
http://www.foxtable.com/webhelp/scr/0677.htm
|
||||
-- 作者:有点甜 -- 发布时间:2017/11/6 15:23:00 -- 生成统计表后,参考 http://www.foxtable.com/webhelp/scr/0972.htm
不会做上传实例。 |
||||
-- 作者:cqli -- 发布时间:2017/11/6 16:11:00 --
下拉选择数字,选2,图表显示top 2,选5图表显示 top5
|
||||
-- 作者:有点甜 -- 发布时间:2017/11/6 16:58:00 -- Dim sqrq As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1") If sqrq.value = Nothing OrElse zzrq.value = Nothing For i As Integer = 0 To num |
||||
-- 作者:cqli -- 发布时间:2017/11/6 17:59:00 -- Dim dt As DataTable Dim b As New GroupTableBuilder("设备故障统计表",DataTables("表A")) b.filter = "[日期] > = #" & sqrq.value & "# And [日期] < #" & zzrq.value.adddays(1) & "#" b.Groups.AddDef("设备编号") b.Totals.AddDef("设备编号",AggregateEnum.Count, "故障次数") dt = b.Build(False) 怎么转成 出错 Dim dt As DataTable Dim b As New SQLGroupTableBuilder("设备故障统计表","表A") b.filter = "[日期] > = \'" & sqrq.value & "\' And [日期] < \'" & zzrq.value.adddays(1) & "\'" b.Groups.AddDef("设备编号") b.Totals.AddDef("设备编号",AggregateEnum.Count, "故障次数") dt = b.Build(False) |
||||
-- 作者:有点甜 -- 发布时间:2017/11/6 18:15:00 -- 加上你的数据源名
b.ConnectionName = "aaa" |