VB2010-繪製折線圖
Public Class Form1
'Boundary of plot
Const LeftSpan As Integer = 15
Const TopSpan As Integer = 15
Const AxYHeight As Integer = 200
Const AxXWidth As Integer = 350
'Range of plot
Const XRangeMax As Integer = 20
Const YRangeMax As Integer = 30000
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim G As Graphics = Me.CreateGraphics
Dim I, X, Y As Integer
Dim LX As Integer = -1000, LY As Integer = -1000
Dim Data1X(20) As Integer
Data1X(0) = 27000 : Data1X(1) = 27000 : Data1X(2) = 27000
Data1X(3) = 27000 : Data1X(4) = 26500 : Data1X(5) = 26500
Data1X(6) = 26000 : Data1X(7) = 26000 : Data1X(8) = 25500
Data1X(9) = 25000 : Data1X(10) = 24500 : Data1X(11) = 24000
Data1X(12) = 24000 : Data1X(13) = 23000 : Data1X(14) = 22000
Data1X(15) = 22000 : Data1X(16) = 21500 : Data1X(17) = 22000
Data1X(18) = 22000 : Data1X(19) = 22500 : Data1X(20) = 23000
G.DrawLine(Pens.Black, LeftSpan, TopSpan, LeftSpan, TopSpan + AxYHeight)
G.DrawLine(Pens.Black, LeftSpan, TopSpan + AxYHeight, LeftSpan + AxXWidth, TopSpan + AxYHeight)
For I = 0 To XRangeMax Step 2
X = I / XRangeMax * AxXWidth + LeftSpan
G.DrawLine(Pens.Blue, X, TopSpan + AxYHeight - 5, X, TopSpan + AxYHeight + 5)
G.DrawString((I + 2000), Me.Font, Brushes.Black, X - Me.Font.Size, TopSpan + AxYHeight + 5)
Next
For I = 5000 To YRangeMax Step 5000
Y = AxYHeight - (I / YRangeMax * AxYHeight) + TopSpan
G.DrawLine(Pens.OrangeRed, LeftSpan - 5, Y, LeftSpan + 5, Y)
G.DrawString(I, Me.Font, Brushes.Black, LeftSpan + 2, Y - Me.Font.Size / 2)
Next
For I = 0 To UBound(Data1X)
X = I / XRangeMax * AxXWidth + LeftSpan
Y = AxYHeight - (Data1X(I) / YRangeMax * AxYHeight) + TopSpan
G.DrawEllipse(Pens.Red, X - 2, Y - 2, 5, 5)
If LX > 0 Then
G.DrawLine(Pens.Red, X, Y, LX, LY)
End If
LX = X
LY = Y
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
2017年12月11日 星期一
訂閱:
張貼留言 (Atom)
WOKWI LED + MQTT Node-Red SQLite
WOKWI LED + MQTT Node-Red SQLite const char *mqtt_broker = "broker.mqtt-dashboard.com" ; const char *topic1 = "alex9ufo/e...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
-
• 認 識 PreFix、InFix、PostFix PreFix(前序式):* + 1 2 + 3 4 InFix(中序式): (1+2)*(3+4) PostFix(後序式):1 2 + 3 4 + * 後 序式的運算 例如: 運算時由 後序式的...
沒有留言:
張貼留言