+Zoom
This commit is contained in:
43
DogeCharts/Form1.Designer.vb
generated
43
DogeCharts/Form1.Designer.vb
generated
@@ -1,9 +1,9 @@
|
|||||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||||
Partial Class Form1
|
Partial Class Form1
|
||||||
Inherits System.Windows.Forms.Form
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
<System.Diagnostics.DebuggerNonUserCode()>
|
||||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
Try
|
Try
|
||||||
If disposing AndAlso components IsNot Nothing Then
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
@@ -20,7 +20,7 @@ Partial Class Form1
|
|||||||
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
||||||
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
||||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||||
<System.Diagnostics.DebuggerStepThrough()> _
|
<System.Diagnostics.DebuggerStepThrough()>
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Dim ChartArea1 As System.Windows.Forms.DataVisualization.Charting.ChartArea = New System.Windows.Forms.DataVisualization.Charting.ChartArea()
|
Dim ChartArea1 As System.Windows.Forms.DataVisualization.Charting.ChartArea = New System.Windows.Forms.DataVisualization.Charting.ChartArea()
|
||||||
Dim Legend1 As System.Windows.Forms.DataVisualization.Charting.Legend = New System.Windows.Forms.DataVisualization.Charting.Legend()
|
Dim Legend1 As System.Windows.Forms.DataVisualization.Charting.Legend = New System.Windows.Forms.DataVisualization.Charting.Legend()
|
||||||
@@ -28,33 +28,30 @@ Partial Class Form1
|
|||||||
Me.tbCoinDataURL = New System.Windows.Forms.TextBox()
|
Me.tbCoinDataURL = New System.Windows.Forms.TextBox()
|
||||||
Me.btnGetCoinData = New System.Windows.Forms.Button()
|
Me.btnGetCoinData = New System.Windows.Forms.Button()
|
||||||
Me.Chart1 = New System.Windows.Forms.DataVisualization.Charting.Chart()
|
Me.Chart1 = New System.Windows.Forms.DataVisualization.Charting.Chart()
|
||||||
Me.Panel1 = New System.Windows.Forms.Panel()
|
|
||||||
CType(Me.Chart1, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.Chart1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.Panel1.SuspendLayout()
|
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'tbCoinDataURL
|
'tbCoinDataURL
|
||||||
'
|
'
|
||||||
Me.tbCoinDataURL.Location = New System.Drawing.Point(18, 18)
|
Me.tbCoinDataURL.Location = New System.Drawing.Point(12, 12)
|
||||||
Me.tbCoinDataURL.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
|
||||||
Me.tbCoinDataURL.Name = "tbCoinDataURL"
|
Me.tbCoinDataURL.Name = "tbCoinDataURL"
|
||||||
Me.tbCoinDataURL.Size = New System.Drawing.Size(494, 26)
|
Me.tbCoinDataURL.Size = New System.Drawing.Size(331, 20)
|
||||||
Me.tbCoinDataURL.TabIndex = 0
|
Me.tbCoinDataURL.TabIndex = 0
|
||||||
Me.tbCoinDataURL.Text = "https://www.hirnwun.de:4555/c/getCoinData.php"
|
Me.tbCoinDataURL.Text = "https://www.hirnwun.de:4555/c/getCoinData.php"
|
||||||
'
|
'
|
||||||
'btnGetCoinData
|
'btnGetCoinData
|
||||||
'
|
'
|
||||||
Me.btnGetCoinData.Location = New System.Drawing.Point(524, 15)
|
Me.btnGetCoinData.Location = New System.Drawing.Point(349, 10)
|
||||||
Me.btnGetCoinData.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
|
||||||
Me.btnGetCoinData.Name = "btnGetCoinData"
|
Me.btnGetCoinData.Name = "btnGetCoinData"
|
||||||
Me.btnGetCoinData.Size = New System.Drawing.Size(112, 35)
|
Me.btnGetCoinData.Size = New System.Drawing.Size(75, 23)
|
||||||
Me.btnGetCoinData.TabIndex = 1
|
Me.btnGetCoinData.TabIndex = 1
|
||||||
Me.btnGetCoinData.Text = "get data"
|
Me.btnGetCoinData.Text = "get data"
|
||||||
Me.btnGetCoinData.UseVisualStyleBackColor = True
|
Me.btnGetCoinData.UseVisualStyleBackColor = True
|
||||||
'
|
'
|
||||||
'Chart1
|
'Chart1
|
||||||
'
|
'
|
||||||
Me.Chart1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
|
Me.Chart1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
|
||||||
|
Or System.Windows.Forms.AnchorStyles.Left) _
|
||||||
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||||
ChartArea1.AxisX.Crossing = -1.7976931348623157E+308R
|
ChartArea1.AxisX.Crossing = -1.7976931348623157E+308R
|
||||||
ChartArea1.AxisX.IsLabelAutoFit = False
|
ChartArea1.AxisX.IsLabelAutoFit = False
|
||||||
@@ -79,8 +76,7 @@ Partial Class Form1
|
|||||||
Legend1.Position.X = 86.59587!
|
Legend1.Position.X = 86.59587!
|
||||||
Legend1.Position.Y = 3.0!
|
Legend1.Position.Y = 3.0!
|
||||||
Me.Chart1.Legends.Add(Legend1)
|
Me.Chart1.Legends.Add(Legend1)
|
||||||
Me.Chart1.Location = New System.Drawing.Point(4, 54)
|
Me.Chart1.Location = New System.Drawing.Point(12, 39)
|
||||||
Me.Chart1.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
|
||||||
Me.Chart1.Name = "Chart1"
|
Me.Chart1.Name = "Chart1"
|
||||||
Series1.ChartArea = "ChartArea1"
|
Series1.ChartArea = "ChartArea1"
|
||||||
Series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line
|
Series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line
|
||||||
@@ -88,31 +84,21 @@ Partial Class Form1
|
|||||||
Series1.Legend = "Legend1"
|
Series1.Legend = "Legend1"
|
||||||
Series1.Name = "DOGE"
|
Series1.Name = "DOGE"
|
||||||
Me.Chart1.Series.Add(Series1)
|
Me.Chart1.Series.Add(Series1)
|
||||||
Me.Chart1.Size = New System.Drawing.Size(1125, 348)
|
Me.Chart1.Size = New System.Drawing.Size(776, 399)
|
||||||
Me.Chart1.TabIndex = 2
|
Me.Chart1.TabIndex = 2
|
||||||
Me.Chart1.Text = "Chart1"
|
Me.Chart1.Text = "Chart1"
|
||||||
'
|
'
|
||||||
'Panel1
|
|
||||||
'
|
|
||||||
Me.Panel1.Controls.Add(Me.Chart1)
|
|
||||||
Me.Panel1.Location = New System.Drawing.Point(37, 113)
|
|
||||||
Me.Panel1.Name = "Panel1"
|
|
||||||
Me.Panel1.Size = New System.Drawing.Size(1151, 452)
|
|
||||||
Me.Panel1.TabIndex = 3
|
|
||||||
'
|
|
||||||
'Form1
|
'Form1
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||||
Me.ClientSize = New System.Drawing.Size(1200, 692)
|
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||||
Me.Controls.Add(Me.Panel1)
|
Me.Controls.Add(Me.Chart1)
|
||||||
Me.Controls.Add(Me.btnGetCoinData)
|
Me.Controls.Add(Me.btnGetCoinData)
|
||||||
Me.Controls.Add(Me.tbCoinDataURL)
|
Me.Controls.Add(Me.tbCoinDataURL)
|
||||||
Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
|
|
||||||
Me.Name = "Form1"
|
Me.Name = "Form1"
|
||||||
Me.Text = "Form1"
|
Me.Text = "Form1"
|
||||||
CType(Me.Chart1, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.Chart1, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.Panel1.ResumeLayout(False)
|
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
Me.PerformLayout()
|
Me.PerformLayout()
|
||||||
|
|
||||||
@@ -121,5 +107,4 @@ Partial Class Form1
|
|||||||
Friend WithEvents tbCoinDataURL As TextBox
|
Friend WithEvents tbCoinDataURL As TextBox
|
||||||
Friend WithEvents btnGetCoinData As Button
|
Friend WithEvents btnGetCoinData As Button
|
||||||
Friend WithEvents Chart1 As DataVisualization.Charting.Chart
|
Friend WithEvents Chart1 As DataVisualization.Charting.Chart
|
||||||
Friend WithEvents Panel1 As Panel
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ Public Class Form1
|
|||||||
tblData.Columns.Add("tStamp")
|
tblData.Columns.Add("tStamp")
|
||||||
tblData.Columns.Add("priceEUR")
|
tblData.Columns.Add("priceEUR")
|
||||||
|
|
||||||
|
Chart1.ChartAreas(0).AxisX.ScaleView.Zoomable = True
|
||||||
|
Chart1.ChartAreas(0).AxisY.ScaleView.Zoomable = True
|
||||||
|
|
||||||
|
|
||||||
With Chart1.Series.Item(0)
|
With Chart1.Series.Item(0)
|
||||||
.LabelAngle = 90
|
.LabelAngle = 90
|
||||||
.MarkerStep = 5
|
.MarkerStep = 5
|
||||||
@@ -49,7 +53,74 @@ Public Class Form1
|
|||||||
'Dim resp As HttpWebResponse = wReq.GetResponse
|
'Dim resp As HttpWebResponse = wReq.GetResponse
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Dim numberOfZoom As Int32 = 0
|
||||||
|
Private Sub Chart1_MouseWheel(sender As Object, e As MouseEventArgs) Handles Chart1.MouseWheel
|
||||||
|
'Dim chart = Chart1
|
||||||
|
'Dim xAxis = chart.ChartAreas(0).AxisX
|
||||||
|
'Dim yAxis = chart.ChartAreas(0).AxisY
|
||||||
|
|
||||||
|
'Try
|
||||||
|
|
||||||
|
' If e.Delta < 0 Then
|
||||||
|
' xAxis.ScaleView.ZoomReset()
|
||||||
|
' yAxis.ScaleView.ZoomReset()
|
||||||
|
' ElseIf e.Delta > 0 Then
|
||||||
|
' Dim xMin = xAxis.ScaleView.ViewMinimum
|
||||||
|
' Dim xMax = xAxis.ScaleView.ViewMaximum
|
||||||
|
' Dim yMin = yAxis.ScaleView.ViewMinimum
|
||||||
|
' Dim yMax = yAxis.ScaleView.ViewMaximum
|
||||||
|
' Dim posXStart = xAxis.PixelPositionToValue(e.Location.X) - (xMax - xMin) / 4
|
||||||
|
' Dim posXFinish = xAxis.PixelPositionToValue(e.Location.X) + (xMax - xMin) / 4
|
||||||
|
' Dim posYStart = yAxis.PixelPositionToValue(e.Location.Y) - (yMax - yMin) / 4
|
||||||
|
' Dim posYFinish = yAxis.PixelPositionToValue(e.Location.Y) + (yMax - yMin) / 4
|
||||||
|
' xAxis.ScaleView.Zoom(posXStart, posXFinish)
|
||||||
|
' 'yAxis.ScaleView.Zoom(posYStart, posYFinish)
|
||||||
|
' End If
|
||||||
|
|
||||||
|
'Catch
|
||||||
|
'End Try
|
||||||
|
|
||||||
|
Dim chart = Chart1
|
||||||
|
Dim xAxis = chart.ChartAreas(0).AxisX
|
||||||
|
Dim yAxis = chart.ChartAreas(0).AxisY
|
||||||
|
Dim xMin = xAxis.ScaleView.ViewMinimum
|
||||||
|
Dim xMax = xAxis.ScaleView.ViewMaximum
|
||||||
|
Dim yMin = yAxis.ScaleView.ViewMinimum
|
||||||
|
Dim yMax = yAxis.ScaleView.ViewMaximum
|
||||||
|
Dim IntervalX As Integer = 3
|
||||||
|
Dim IntervalY As Integer = 3
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
If e.Delta < 0 AndAlso numberOfZoom > 0 Then
|
||||||
|
Dim posXStart = xAxis.PixelPositionToValue(e.Location.X) - IntervalX * 2 / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posXFinish = xAxis.PixelPositionToValue(e.Location.X) + IntervalX * 2 / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posYStart = yAxis.PixelPositionToValue(e.Location.Y) - IntervalY * 2 / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posYFinish = yAxis.PixelPositionToValue(e.Location.Y) + IntervalY * 2 / Math.Pow(2, numberOfZoom)
|
||||||
|
If posXStart < 0 Then posXStart = 0
|
||||||
|
If posYStart < 0 Then posYStart = 0
|
||||||
|
If posYFinish > yAxis.Maximum Then posYFinish = yAxis.Maximum
|
||||||
|
If posXFinish > xAxis.Maximum Then posYFinish = xAxis.Maximum
|
||||||
|
xAxis.ScaleView.Zoom(posXStart, posXFinish)
|
||||||
|
'yAxis.ScaleView.Zoom(posYStart, posYFinish)
|
||||||
|
numberOfZoom -= 1
|
||||||
|
ElseIf e.Delta < 0 AndAlso numberOfZoom = 0 Then
|
||||||
|
yAxis.ScaleView.ZoomReset()
|
||||||
|
xAxis.ScaleView.ZoomReset()
|
||||||
|
ElseIf e.Delta > 0 Then
|
||||||
|
Dim posXStart = xAxis.PixelPositionToValue(e.Location.X) - IntervalX / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posXFinish = xAxis.PixelPositionToValue(e.Location.X) + IntervalX / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posYStart = yAxis.PixelPositionToValue(e.Location.Y) - IntervalY / Math.Pow(2, numberOfZoom)
|
||||||
|
Dim posYFinish = yAxis.PixelPositionToValue(e.Location.Y) + IntervalY / Math.Pow(2, numberOfZoom)
|
||||||
|
xAxis.ScaleView.Zoom(posXStart, posXFinish)
|
||||||
|
'yAxis.ScaleView.Zoom(posYStart, posYFinish)
|
||||||
|
numberOfZoom += 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
If numberOfZoom < 0 Then numberOfZoom = 0
|
||||||
|
Catch
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user