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


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.