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 Stackoverflow.com 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.

1
0

Hi.

I am evaluating the SciChart control – so far it looks very promising.

I have a FastHeatMapRenderableSeries that is analyzed and a FastLineRenderableSeries line is drawn through the chart.

The user needs to be able to correct the analysis, and this is done by “drawing” in the heatmap.

As far as I could tell, the ChartModifierBase gives med the necessary hooks to track the user’s mouse movements – but I would like to give some visual feedback by changing the cursor, for instance to Cursors.Pen (Cursors from the Microsoft namespace)

Is this possible? I would want to enable drawing when user presses Ctrl, the disable it when user releases Ctrl…

Version
v4.2.1
  • You must to post comments
0
0

Hi Espen,

This should be really easy. WPF itself gives a mechanism to change the cursor of a WPF UserControl, such as the SciChartSurface.

SciChartSurface.Cursor = Cursors.Pen;

For a way to do this using our ChartModifier API, you could create some code like this:

public class CursorChangeModifier : ChartModifierBase
{
    public override void OnModifierKeyDown(ModifierKeyArgs e)
    {
        base.OnModifierKeyDown(e);

        base.SetCursor(e.Modifier == MouseModifier.Ctrl ? Cursors.Pen : Cursors.Arrow);
    }
}

sciChartSurface.ChartModifier = new ModifierGroup(new CursorChangeModifier());

That should do it, it should now change cursor to Hand when you press the CTRL key and Arrow when you release it.

Note you will need to first click on the chart to give it focus or Key events won’t fire.

As for drawing, you will need to listen to OnModifierMouseDown, OnModifierMouseUp, OnModifierMouseMove, and then change the X,Y values in a XyDataSeries / FastLineRenderableSeries pair. You can do this inside a ChartModifier to allow ‘drawing’ on the chart.

Or, or more complex shapes drawing, note that ChartModifierBase.ModifierSurface is a canvas which accepts any WPF UIElement.

For more info about our ChartModifier API please see here. For any questions, please ask!

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.