CHAR实时趋势

Public Class Form1

    Dim x(10) As String, y(10) As Double 'º?¤yD?º?11¬?ºyY

    Dim yy() As Double

 

    Private Sub Button1_Click(ByValsender As System.Object,ByVal e AsSystem.EventArgs) HandlesButton1.Click

        'ã¡ä£¤Ì£¤¡Âº?t¡êa¨?ºy

        yy = GetValue()

        Dim i As Integer

        For i =0 To yy.Length - 1

            y(i) = yy(i)

        Next

 

        Chart1.Series(0).ChartType =DataVisualization.Charting.SeriesChartType.Line

        Chart1.Series(0).Points.DataBindXY(x,y)

 

        Chart1.Series(0).IsValueShownAsLabel = True

        Chart1.Series(0).LabelForeColor = Color.Red

        Chart1.ChartAreas(0).AxisX.Minimum = 0

        Chart1.ChartAreas(0).AxisX.Maximum =yy.Length

        Chart1.ChartAreas(0).AxisX.Interval = 1

    End Sub

    Private Sub Form1_Load(ByValsender As Object,ByVal e As EventArgs) HandlesMyBase.Load

        Chart1.Dock = DockStyle.Fill

        Button1.BringToFront()

       Chart1.ChartAreas(0).AxisX.MajorGrid.Enabled = False

       Chart1.ChartAreas(0).AxisY.MajorGrid.Enabled = False

    End Sub

    FunctionGetValue() As Array'aº?°??¡êa¨?ºyÌ?¡¥ºy

        Dim a As Integer = 0

        If yy Is Nothing Then

            a = 0

        Else

            a = yy.Length

        End If

        If a =11 Then

            Fori As Integer =0 To 9

                yy(i) = yy(i + 1)

                x(i) = x(i + 1)

            Next

            yy(10) = Math.Round(a* Rnd(100) * 1.0264, 2)

            x(10) = Format(Now, "hh:mm:ss")

        Else

            ReDimPreserve yy(a)

            yy(a) = Math.Round(a* Rnd(100) * 1.0264, 2)

            x(a) = Format(Now, "hh:mm:ss")

        End If

        Returnyy

    End Function

 

   

End Class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值