SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.



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

  • You must to post comments
Best Answer

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,

  • 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

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)
        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.