Pre loader

Doubleclick on y-axis to set extents to visible range

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

Hello,

How would I go about creating a modifier (or extending an existing one?) that will allow the user to doubleclick on the y-axis to set the y-axis extents to the y-values in the visible x-range? can I capture a doubleclick on the y-axis?

I would like to reserve the doubleclick on the surface for other features, that’s why I don’t use the zoomextents modifier.

Thank you
Mathias

  • You must to post comments
Best Answer
1
0

Hi Mathias,

Thank you for your question! Please check out our series on the ChartModifier API as a basis. This will talk you through the basics and also we have a series of example modifiers to show what this powerful API can do.

To detect if a click was on the YAxis, check out this article: ChartModifierBase Get Notification of MouseDown on Axis or Chart pane

Basically what I would suggest is to override ChartModifierBase.OnModifierDoubleClick and use the technique above to determine where the click was.

Finally, to Zoom to Extents programmatically, you can call the method SciChartSurface.ZoomExtentsY().

Hope this helps!

Best regards,
Andrew

  • Mathias Vanden Auweele
    Thanks, that's just the pointer i needed to solve the puzzle!
  • Mathias Vanden Auweele
    Andrew, I still have a slight problem with getting two modifiers based on doubleclick to work together. So the zoomextents works fine, I'll post my code below. But the one below will also open the windows when you doubleclick on the y-axis. Can it be that I'm not using the right IHitTestable element "ModifierSurface"? Public Overrides Sub OnModifierDoubleClick(e As ModifierMouseArgs) MyBase.OnModifierDoubleClick(e) If IsPointWithinBounds(e.MousePoint, ModifierSurface) Then Dim pt = GetPointRelativeTo(e.MousePoint, ModifierSurface) If ActivateAlert Then Dim workorderForm = New Workorder(pt.X, _measurementCollection, _mainViewModel, _mainWindow) workorderForm.Show() Else Dim timePlot = New TimeSeries(pt.X, _measurementCollection, _mainViewModel) timePlot.Show() End If End If End Sub
  • You must to post comments
1
0

Thanks for the help, here is my code for others who might be interested:

Imports Abt.Controls.SciChart.ChartModifiers
Imports Abt.Controls.SciChart.Visuals

Public Class ZoomExtentsOnYAxisModifier
    Inherits ChartModifierBase

    Public Overrides Sub OnModifierDoubleClick(e As ModifierMouseArgs)
        MyBase.OnModifierDoubleClick(e)
        Dim isOnYAxis As Boolean = IsPointWithinBounds(e.MousePoint, YAxis)

        If isOnYAxis Then
            TryCast(ParentSurface, SciChartSurface).ZoomExtentsY()
        End If
    End Sub
End Class
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies