以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 水平坐标字符表示 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=143098) |
-- 作者:季朝龙 -- 发布时间:2019/11/13 15:29:00 -- 水平坐标字符表示 老师帮忙看看一下代码怎么无法实现“水平坐标字符表示”! Dim Chart1 As WinForm.Chart \'定义一个图表变量 Dim Series1 As WinForm.ChartSeries \'定义一个图系变量 Chart1 = e.Form.Controls("时段产出") \' 引用窗口中的图表 Chart1.ChartType = ChartTypeEnum.Bar \'图表类型改为Bar(条形) Chart1.SeriesList.Clear() \'清除图表原来的图系 Series1 = Chart1.SeriesList.Add() \'增加一个图系 Series1.Length = 12 \'新增图系包括11个数据点 Series1.X(0) = 0 Series1.X(1) = 1 Series1.X(2) = 2 Series1.X(3) = 3 Series1.X(4) = 4 Series1.X(5) = 5 Series1.X(6) = 6 Series1.X(7) = 7 Series1.X(8) = 8 Series1.X(9) = 9 Series1.X(10) = 10 Series1.X(11) = 11 Chart1.AxisX.SetValueLabel(0, "A") Chart1.AxisX.SetValueLabel(1, "B") Chart1.AxisX.SetValueLabel(2, "C") Chart1.AxisX.SetValueLabel(3, "D") Chart1.AxisX.SetValueLabel(4, "E") Chart1.AxisX.SetValueLabel(5, "F") Chart1.AxisX.SetValueLabel(6, "I") Chart1.AxisX.SetValueLabel(7, "J") Chart1.AxisX.SetValueLabel(8, "K") Chart1.AxisX.SetValueLabel(9, "L") Chart1.AxisX.SetValueLabel(10, "M") Chart1.AxisX.SetValueLabel(11, "N") Series1.Y(0) = r0 Series1.Y(1) = r1 Series1.Y(2) = r2 Series1.Y(3) = r3 Series1.Y(4) = r4 Series1.Y(5) = r5 Series1.Y(6) = r6 Series1.Y(7) = r7 Series1.Y(8) = r8 Series1.Y(9) = r9 Series1.Y(10) = r10 Series1.Y(11) = r11 Chart1.AxisX.AnnoWithLabels = True Chart1.BackColor = color.Moccasin Chart1.LegendCompass= CompassEnum.south Chart1.headerText = "时段产出" Chart1.HeaderFont = New Font("宋体", 16, FontStyle.Bold) |
-- 作者:有点蓝 -- 发布时间:2019/11/13 15:37:00 -- 没看懂,截图说明一下 |
-- 作者:季朝龙 -- 发布时间:2019/11/13 17:12:00 -- 抱歉,刚刚漏复制了一段代码,难怪老师看不懂 现在问题找到了,原来是我自己控件代码改了,计时器代码没有改所以没看到修改后的结果。 还是非常感谢老师的耐心帮助!
Dim md,md1 As Integer Dim nd As String Dim rd,rd1 As Integer Dim ld As String Dim r0 As Integer Dim r1 As Integer Dim r2 As Integer Dim r3 As Integer Dim r4 As Integer Dim r5 As Integer Dim r6 As Integer Dim r7 As Integer Dim r8 As Integer Dim r9 As Integer Dim r10 As Integer Dim r11 As Integer ld = e.Form.Controls("工位输入").text nd = e.Form.Controls("订单号输入").text md = DataTables("生产数据").SQLCompute("Count(绑定临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' ") Dim sj0,sj11,sj12,sj9,sj13,sj10,sj14,sj15,sj16,sj17,sj18,sj19,sj24 As Date sj0 = Date.Today.AddHours(0) sj9 = Date.Today.AddHours(9) sj10 = Date.Today.AddHours(10) sj11 = Date.Today.AddHours(11) sj12 = Date.Today.AddHours(12) sj13 = Date.Today.AddHours(13) sj14 = Date.Today.AddHours(14) sj15 = Date.Today.AddHours(15) sj16 = Date.Today.AddHours(16) sj17 = Date.Today.AddHours(17) sj18 = Date.Today.AddHours(18) sj19 = Date.Today.AddHours(19) sj24 = Date.Today.AddHours(24) e.Form.Controls("总产出").text = md rd = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj0 & "\'and 投入时间 < \'" & sj24 & "\' ") e.Form.Controls("当日产出").text = rd r0 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 < \'" & sj0 & "\' ") e.Form.Controls("0").text = r0 r1 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj0 & "\'and 投入时间 < \'" & sj9 & "\' ") e.Form.Controls("1").text = r1 r2 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj9 & "\'and 投入时间 < \'" & sj10 & "\' ") e.Form.Controls("2").text = r2 r3 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj10 & "\'and 投入时间 < \'" & sj11 & "\' ") e.Form.Controls("3").text = r3 r4 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj11 & "\'and 投入时间 < \'" & sj12 & "\' ") e.Form.Controls("4").text = r4 r5 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj13 & "\'and 投入时间 < \'" & sj14 & "\' ") e.Form.Controls("5").text = r5 r6 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj14 & "\'and 投入时间 < \'" & sj15 & "\' ") e.Form.Controls("6").text = r6 r7 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj15 & "\'and 投入时间 < \'" & sj16 & "\' ") e.Form.Controls("7").text = r7 r8 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj16 & "\'and 投入时间 < \'" & sj17 & "\' ") e.Form.Controls("8").text = r8 r9 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj17 & "\'and 投入时间 < \'" & sj18 & "\' ") e.Form.Controls("9").text = r9 r10 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj18 & "\'and 投入时间 < \'" & sj19 & "\' ") e.Form.Controls("10").text = r10 r11 = DataTables("生产数据").SQLCompute("Count(临时码)" ,"订单号 = \'" & nd & "\' and 绑定临时码 = \'" & ld & "\' and 投入时间 >= \'" & sj19 & "\'and 投入时间 < \'" & sj24 & "\' ") e.Form.Controls("11").text = r11 e.Form.Controls("总产出").text = md Dim Chart1 As WinForm.Chart \'定义一个图表变量 Dim Series1 As WinForm.ChartSeries \'定义一个图系变量 Chart1 = e.Form.Controls("时段产出") \' 引用窗口中的图表 Chart1.ChartType = ChartTypeEnum.Bar \'图表类型改为Bar(条形) Chart1.SeriesList.Clear() \'清除图表原来的图系 Series1 = Chart1.SeriesList.Add() \'增加一个图系 Series1.Length = 12 \'新增图系包括11个数据点 Series1.X(0) = 0 Series1.X(1) = 1 Series1.X(2) = 2 Series1.X(3) = 3 Series1.X(4) = 4 Series1.X(5) = 5 Series1.X(6) = 6 Series1.X(7) = 7 Series1.X(8) = 8 Series1.X(9) = 9 Series1.X(10) = 10 Series1.X(11) = 11 Chart1.AxisX.SetValueLabel(0, "当日之前") Chart1.AxisX.SetValueLabel(1, "0到9点") Chart1.AxisX.SetValueLabel(2, "9到10点") Chart1.AxisX.SetValueLabel(3, "10到11点") Chart1.AxisX.SetValueLabel(4, "11到12点") Chart1.AxisX.SetValueLabel(5, "12到14点") Chart1.AxisX.SetValueLabel(6, "14到15点") Chart1.AxisX.SetValueLabel(7, "15到16点") Chart1.AxisX.SetValueLabel(8, "16到17点") Chart1.AxisX.SetValueLabel(9, "17到18点") Chart1.AxisX.SetValueLabel(10, "18到19点") Chart1.AxisX.SetValueLabel(11, "19到24点") Series1.Y(0) = r0 Series1.Y(1) = r1 Series1.Y(2) = r2 Series1.Y(3) = r3 Series1.Y(4) = r4 Series1.Y(5) = r5 Series1.Y(6) = r6 Series1.Y(7) = r7 Series1.Y(8) = r8 Series1.Y(9) = r9 Series1.Y(10) = r10 Series1.Y(11) = r11 Chart1.AxisX.AnnoWithLabels = True Chart1.AxisX.AnnoRotation = -45 Chart1.BackColor = color.Moccasin Chart1.LegendCompass= CompassEnum.south Chart1.headerText = "时段产出" Chart1.HeaderFont = New Font("宋体", 16, FontStyle.Bold) |