question

EnzoTernavasio-9821 avatar image
0 Votes"
EnzoTernavasio-9821 asked BobJohnson-6874 edited

Chart coordinates have low resolution and are slow

I have a chart and i want to show coordinates when moving mouse on it.
This is the software:
Private Sub Chart1_MouseMove(sender As Object, e As MouseEventArgs) Handles Chart1.MouseMove

     Dim pos, settore_unita As Single
     Dim x, y As Single

     If Me.Chart1.ChartAreas(0).AxisY.Enabled = 1 Then
         Me.Label_tempo.Visible = True
         Dim ht As DataVisualization.Charting.HitTestResult = Chart1.HitTest(e.X, e.Y)
         If Not ht.ChartElementType = ChartElementType.Nothing Then
             Dim xx As Double = ht.ChartArea.AxisX.PixelPositionToValue(e.X)
             Dim yy As Double = ht.ChartArea.AxisY.PixelPositionToValue(e.Y)
             If xx >= Chart1.ChartAreas(0).AxisX.Minimum And xx <= Chart1.ChartAreas(0).AxisX.Maximum And
                 yy >= Chart1.ChartAreas(0).AxisY.Minimum And yy <= Chart1.ChartAreas(0).AxisY.Maximum Then
                 Me.Label_tempo.Text = Format(yy, "f")
             End If
         End If
     End If


 End Sub

The problem is that the resolution is low (never appears zero when on top of chart) and refreshing is slow.
The same program in VB6 works perfectely.

not-supported
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers