Pre loader

ChartModifierBase.OnModifierMouseDown fires when user clicks Axis

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


When a user clicks on Axis (x or y), ChartModifierBase.OnModifierMouseDown is called. As axis are outside of chart zoom area, this should not be called. Is there anyway to know that ChartModifierBase.OnModifierMouseDown is on axis and not on chart area?

  • You must to post comments

Hi Manish,

As modifiers can perform operations on the axes, its correct behaviour that ChartModifierBase receives an OnModifierMouseDown event when the mouse is clicked on an axis.

Internally, to check whether the mouse point is inside the main chart area (i.e. not on an axis), RubberBandXyZoomModifier has this code:

public override void OnModifierMouseDown(ModifierMouseArgs e)
    if (_isDragging || e.MouseButtons != MouseButtons.Left)

    var modifierSurfaceBounds = ModifierSurface.GetBoundsRelativeTo(RootGrid);
    bool isClickOnChart = modifierSurfaceBounds.Contains(e.MousePoint);

    // Exit if the mouse down was outside the bounds of the ModifierSurface
    if (!isClickOnChart)

    // ... 

It sounds like you are creating a custom modifier. If so please be aware that all mouse points that are sent to the OnModifierMouse* methods are relative to the parent SciChartSurface.RootGrid. If you wanted to get a mouse point relative to the chart area itself, you can use this code:

    // Translate the mouse point (which is in RootGrid coordinates) relative to the ModifierSurface
    // This accounts for any offset due to left Y-Axis
    var ptTrans = RootGrid.TranslatePoint(e.MousePoint, ModifierSurface);
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.