Page 1 of 1

MouseMoveOff problem

Posted: Tue Mar 17, 2015 12:51 pm
by fredd41
hi

Your MouseMoveOff event doesn't work properly.
If you move your mouse outside of the object very fast, the event is not fired.

example:

AddHandler Chart.ViewXY.YAxes(0).MouseOverOn, AddressOf YAxis_MouseMoveOn
AddHandler Chart.ViewXY.YAxes(0).MouseOverOff, AddressOf YAxis_MouseMoveOff

Private Sub YAxis_MouseMoveOn(sender As Object, e As MouseEventArgs)
Chart.ViewXY.YAxes(0).LabelsColor = Color.black
End Sub

Private Sub YAxis_MouseMoveOff(sender As Object, e As MouseEventArgs)
Chart.ViewXY.YAxes(0).LabelsColor = Color.white
End Sub

thanks

Re: MouseMoveOff problem

Posted: Thu Mar 19, 2015 5:15 pm
by ArctionPasi
I can't reproduce the problem... Made similar app, moved mouse out of the chart area, over other elements on and off very quickly and Off event always turned the title back to White.

Can you tell a little bit more exactly where have you positioned the Y axis? Using other objects, such as Annotations there? Picture would be nice... :roll:

Re: MouseMoveOff problem

Posted: Thu Mar 19, 2015 6:29 pm
by fredd41
Imports Arction.LightningChartUltimate.SeriesXY
Imports Arction.LightningChartUltimate
Imports Arction.LightningChartUltimate.Axes

Public Class Form1

Public WithEvents m_Chart As New LightningChartUltimate

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load

m_Chart.Parent = Me
m_Chart.Dock = DockStyle.Fill

Dim axisX As AxisX = m_Chart.ViewXY.XAxes(0)
axisX.SetRange(0, 50)
axisX.ScrollMode = XAxisScrollMode.None
axisX.ValueType = AxisValueType.Number

Dim y As AxisY = New AxisY(m_Chart.ViewXY)
m_Chart.ViewXY.YAxes.Add(y)
m_Chart.ViewXY.YAxes(0).SetRange(-200, -50)
m_Chart.ViewXY.YAxes(0).Title.Visible = False
m_Chart.ViewXY.YAxes(1).Title.Visible = False
m_Chart.ViewXY.YAxes(1).SetRange(-200, -50)
m_Chart.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked
m_Chart.ViewXY.LegendBox.Visible = False

m_Chart.ViewXY.YAxes(0).LabelsColor = Color.White
m_Chart.ViewXY.YAxes(1).LabelsColor = Color.White
AddHandler m_Chart.ViewXY.YAxes(0).MouseOverOn, AddressOf MouseHoverEnter
AddHandler m_Chart.ViewXY.YAxes(0).MouseOverOff, AddressOf MouseHoverLeave
AddHandler m_Chart.ViewXY.YAxes(1).MouseOverOn, AddressOf MouseHoverEnter
AddHandler m_Chart.ViewXY.YAxes(1).MouseOverOff, AddressOf MouseHoverLeave

Dim sds As New SampleDataSeries(m_Chart.ViewXY, axisX, m_Chart.ViewXY.YAxes(0))
sds.LineStyle.Width = 3
sds.LineStyle.Color = Color.Red
Dim samples As Double() = New Double(49) {}
Dim rand As New Random()
For i As Integer = 0 To 49
samples(i) = -150 + 70.0 * rand.NextDouble()
Next
sds.SamplingFrequency = 1
sds.FirstSampleTimeStamp = 1.0 / sds.SamplingFrequency
sds.SamplesDouble = samples
m_Chart.ViewXY.SampleDataSeries.Add(sds)

sds = New SampleDataSeries(m_Chart.ViewXY, axisX, m_Chart.ViewXY.YAxes(1))
sds.LineStyle.Width = 3
sds.LineStyle.Color = Color.Azure
samples = New Double(49) {}
rand = New Random()
For i As Integer = 0 To 49
samples(i) = -150 + 70.0 * rand.NextDouble()
Next
sds.SamplingFrequency = 1
sds.FirstSampleTimeStamp = 1.0 / sds.SamplingFrequency
sds.SamplesDouble = samples
m_Chart.ViewXY.SampleDataSeries.Add(sds)

m_Chart.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked

With m_Chart.ViewXY.ZoomPanOptions
.RightToLeftZoomAction = RightToLeftZoomAction.FitView
.PanDirection = PanDirection.Horizontal
.AxisMouseWheelAction = AxisMouseWheelAction.Zoom
.RightMouseButtonAction = MouseButtonAction.None
.AutoYFit.Enabled = False
.ShiftEnabled = False
.CtrlEnabled = False
.AltEnabled = False
.AutoYFit.TargetAllYAxes = True
.MouseWheelZooming = MouseWheelZooming.Horizontal
.RectangleZoomDirection = RectangleZoomDirection.Horizontal
.AspectRatioOptions.AspectRatio = ViewAspectRatio.Off
.RectangleZoomLimitInsideGraph = True
.RectangleZoomingThreshold.X = 4
End With


End Sub

Public Sub MouseHoverEnter(sender As Object, e As MouseEventArgs)
m_Chart.ViewXY.YAxes(0).LabelsColor = Color.Blue
End Sub

Public Sub MouseHoverLeave(sender As Object, e As MouseEventArgs)
m_Chart.ViewXY.YAxes(0).LabelsColor = Color.White
End Sub

End Class

Re: MouseMoveOff problem

Posted: Thu Mar 19, 2015 6:31 pm
by fredd41
move your mouse over the Y axis and leave quickly (to the left)

Re: MouseMoveOff problem

Posted: Tue Mar 24, 2015 9:33 am
by ArctionJari
Looks like chart's internal event handling routines don't work fast enough to trigger mouse leave event. If you subscribe to chart's mouse leave event, it works.

As a workaround, if you need to do any work in mouse leave event, try subscribing to chart's mouse leave event and check if Y axis' event is not handled or something similar.

We'll look into this and see if we can do anything to make chart's internal event handling faster.