ChrisO's Line graph demo... (1 Viewer)

wiklendt

i recommend chocolate
Local time
Tomorrow, 01:45
Joined
Mar 10, 2008
Messages
1,746
Hi ChrisO,

i just noticed something, don't know if you're aware of it:

when you mouse-over on the graph, the graph flickers on every recalculation of the mouse position (displayed in the textbox top right hand corner).

however, when the TEXTBOX has the focus, mouse over on the graph still works, but better (without the flickering).

i tried No on Enabled for the graph control, but the mouseover then only works if you right-click on the graph (graph still displays)

...just thought you'd like to know... gotta go!
 

ChrisO

Registered User.
Local time
Tomorrow, 01:45
Joined
Apr 30, 2003
Messages
3,202
Thanks for the feedback, Agnieszka.

I can’t test this in A2007 but the following attempted fix might work: -

Code:
Private Sub chtTestChart_MouseMove(ByRef intButton As Integer, _
                                   ByRef intShift As Integer, _
                                   ByRef sngX As Single, _
                                   ByRef sngY As Single)

    Dim lngPoints As Long
    Dim sngXIndex As Single
    Dim sngYValue As Single
    Dim udtPlotXY As udtChartPlotArea
    
    If (conHandleErrors) Then On Error GoTo ErrorHandler

    Me.cmdDummySetFocus.SetFocus   [color=red]' < Try adding this.[/color]
    
    udtPlotXY.X = sngX
    udtPlotXY.Y = sngY
    udtPlotXY.Clamp = Me.optDisplayMousePlotArea
    Set udtPlotXY.Chart = Me.chtTestChart
    
    lngPoints = Me.chtTestChart.SeriesCollection(1).Points.Count
    
    [color=green]' Chart dimensions are in Points, MouseMove is in Twips
    ' Return value of X is left to right, Clamped valid range 0 to 1
    ' Return value of Y is bottom to top, Clamped valid range 0 to 1
    ' If the value is not clamped the update will continue outside the plot area.[/color]
    With GetPlotAreaMousePosition(udtPlotXY)
        sngXIndex = Int(.X * lngPoints + 1)
        If sngXIndex < 1 Then sngXIndex = 1
        If sngXIndex > lngPoints Then sngXIndex = lngPoints
        sngYValue = (Me.chtTestChart.Axes(conYAxis).MaximumScale _
                   - Me.chtTestChart.Axes(conYAxis).MinimumScale) _
                  * .Y + Me.chtTestChart.Axes(conYAxis).MinimumScale
    
        If (.Clamp) Then
            If (.X >= 0 And .X <= 1) And (.Y >= 0 And .Y <= 1) Then
                Me.txtYValue = GetXAxisLabel(Me.chtTestChart, sngXIndex) & " = " & sngYValue
            Else
                Me.txtYValue = ""
            End If
        Else
            Me.txtYValue = GetXAxisLabel(Me.chtTestChart, sngXIndex) & " = " & sngYValue
        End If
    End With
    
ExitProcedure:
    Exit Sub

ErrorHandler:
    DisplayError "chtTestChart_MouseMove", Me.Name
    Resume ExitProcedure
    
End Sub

Regards,
Chris.
 

wiklendt

i recommend chocolate
Local time
Tomorrow, 01:45
Joined
Mar 10, 2008
Messages
1,746
drat. that didn't work. i also tried focus on the txtYValue, without success. after having played around with it a little more, i have noticed that there is no predictable control focus status which prevents the graph from flickering. click around enough and soon the graph with the focus prevents the flicker.

i wish i could help but i don't have any clues. it's still a very very impressive demo, ChrisO. congrats. :)
 

ChrisO

Registered User.
Local time
Tomorrow, 01:45
Joined
Apr 30, 2003
Messages
3,202
That’s okay and thanks for trying.

BTW, welcome to the wonderful world of charting. :rolleyes:

I’ll see if I can fix it when I next get to an A2007 machine.
 

Users who are viewing this thread

Top Bottom