vs2008 中MSCHAR控件的制图源代码 我写了一段 但是显示不出来 求救!!!!!!!!下面是我的代码
PrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBas...
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Chart1.ChartAreas.Clear() '清除所有绘图区
Dim newChartAreas1 As New ChartArea("Default") '新增绘图区
Chart1.ChartAreas.Add(newChartAreas1)
Chart1.ChartAreas("Default").BackColor = Color.FromName("GradientInactiveCaption") '设置绘图区颜色
'Chart1.ChartAreas("Default").BackGradientStyle = GradientStyle.HorizontalCenter '设置绘图区颜色渐变方式
Chart1.ChartAreas("Default").AxisX.IsMarginVisible = True
'Chart1.ChartAreas("Default").Area3DStyle.Enable3D = True '启用3D显示
Chart1.ChartAreas("Default").AxisX.Title = "时间" 'X轴名称
Chart1.ChartAreas("Default").AxisY.Title = "数量" 'Y轴名称
Chart1.Titles.Clear()
Dim newTitles1 As New Title("产品生产管制图") '建立标题
newTitles1.Text = "产品生产管制图"
Chart1.Titles.Add(newTitles1)
Chart1.Series.Clear() '清除所有数据集
Dim newSeries1 As New Series("标准值") '新增数据集
newSeries1.ChartType = SeriesChartType.Line '直线
newSeries1.BorderWidth = 2
newSeries1.Color = Color.Blue
newSeries1.XValueType = ChartValueType.Time
newSeries1.IsValueShownAsLabel = False
Chart1.Series.Add(newSeries1)
Dim newSeries2 As New Series("生产量")
newSeries2.ChartType = SeriesChartType.Line
newSeries2.BorderWidth = 2
newSeries2.Color = Color.Green
newSeries2.XValueType = ChartValueType.Time
newSeries2.IsValueShownAsLabel = True
newSeries2.MarkerStyle = MarkerStyle.Square
Chart1.Series.Add(newSeries2)
Dim newSeries3 As New Series("下限值")
newSeries3.ChartType = SeriesChartType.Line
newSeries3.BorderWidth = 2
newSeries3.Color = Color.OrangeRed
newSeries3.XValueType = ChartValueType.Time
newSeries3.IsValueShownAsLabel = False
Chart1.Series.Add(newSeries3)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim current_time As DateTime
current_time = DateTime.Now
Chart1.Series("标准值").Points.AddXY(current_time, 90)
Chart1.Series("生产量").Points.AddXY(current_time, random.Next(20, 75))
Chart1.Series("下限值").Points.AddXY(current_time, 15)
End Sub 展开
Chart1.ChartAreas.Clear() '清除所有绘图区
Dim newChartAreas1 As New ChartArea("Default") '新增绘图区
Chart1.ChartAreas.Add(newChartAreas1)
Chart1.ChartAreas("Default").BackColor = Color.FromName("GradientInactiveCaption") '设置绘图区颜色
'Chart1.ChartAreas("Default").BackGradientStyle = GradientStyle.HorizontalCenter '设置绘图区颜色渐变方式
Chart1.ChartAreas("Default").AxisX.IsMarginVisible = True
'Chart1.ChartAreas("Default").Area3DStyle.Enable3D = True '启用3D显示
Chart1.ChartAreas("Default").AxisX.Title = "时间" 'X轴名称
Chart1.ChartAreas("Default").AxisY.Title = "数量" 'Y轴名称
Chart1.Titles.Clear()
Dim newTitles1 As New Title("产品生产管制图") '建立标题
newTitles1.Text = "产品生产管制图"
Chart1.Titles.Add(newTitles1)
Chart1.Series.Clear() '清除所有数据集
Dim newSeries1 As New Series("标准值") '新增数据集
newSeries1.ChartType = SeriesChartType.Line '直线
newSeries1.BorderWidth = 2
newSeries1.Color = Color.Blue
newSeries1.XValueType = ChartValueType.Time
newSeries1.IsValueShownAsLabel = False
Chart1.Series.Add(newSeries1)
Dim newSeries2 As New Series("生产量")
newSeries2.ChartType = SeriesChartType.Line
newSeries2.BorderWidth = 2
newSeries2.Color = Color.Green
newSeries2.XValueType = ChartValueType.Time
newSeries2.IsValueShownAsLabel = True
newSeries2.MarkerStyle = MarkerStyle.Square
Chart1.Series.Add(newSeries2)
Dim newSeries3 As New Series("下限值")
newSeries3.ChartType = SeriesChartType.Line
newSeries3.BorderWidth = 2
newSeries3.Color = Color.OrangeRed
newSeries3.XValueType = ChartValueType.Time
newSeries3.IsValueShownAsLabel = False
Chart1.Series.Add(newSeries3)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim current_time As DateTime
current_time = DateTime.Now
Chart1.Series("标准值").Points.AddXY(current_time, 90)
Chart1.Series("生产量").Points.AddXY(current_time, random.Next(20, 75))
Chart1.Series("下限值").Points.AddXY(current_time, 15)
End Sub 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询