0
好吧,我正在嘗試創建一個每秒更改一次並只顯示3秒歷史記錄的圖表。在我的腦海中,將它綁定到T變量中(時間以秒爲單位)是有意義的,所以我將form1輸出到form2上的文本框,然後每次該文本框更改時都會繪製新圖表。這種圖形技術在我的腦海裏工作,爲什麼不在RL?
我之所以採用梯級方法是因爲我希望數字出現在點的下面。
這是否有任何意義,或者我完全脫離基地?
Imports System.Windows.Forms.DataVisualization.Charting
Public Class Form2
Dim chart1 As New Chart
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
If Form1.T <= 2 Then
Label1.Visible = False
TextBox20.Text = TextBox21.Text
TextBox31.Text = TextBox32.Text
TextBox21.Text = TextBox22.Text
TextBox32.Text = TextBox33.Text
TextBox22.Text = Form1.TextBox10.Text
TextBox33.Text = Form1.TextBox4.Text
Dim s1() As Point = {New Point(Form1.T - 2, TextBox20.Text), New Point(Form1.T - 1, TextBox21.Text), New Point(Form1.T, TextBox22.Text)}
Dim s2() As Point = {New Point(Form1.T - 2, TextBox31.Text), New Point(Form1.T - 1, TextBox32.Text), New Point(Form1.T, TextBox33.Text)}
For x As Integer = Form1.T - 2 To Form1.T
chart1.Series(0).Points.Add(x, s1(x).Y)
Next
chart1.Series.Add("Series2")
chart1.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.Line
chart1.Series(1).ChartType = DataVisualization.Charting.SeriesChartType.Line
For x As Integer = Form1.T - 2 To Form1.T
chart1.Series(1).Points.Add(x, s1(x).Y)
Next
chart1.Series(0).Label = "PSS"
chart1.Series(1).Label = "USS"
End If
End Sub
End Class
一個我注意到的問題是T是試圖從一個字符串轉換爲整數。我試圖在if語句中添加「TextBox11.Text = Form1.T」。 – Nefariis