Pre loader

Align Axis across chart surfaces

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

0
0

Hi,

I have a form with two chart surfaces each displaying a chart. I have set their visible ranges to be the same but they have different Y Axis values. This causes the YAxis not to line up. Is there a way I can have the YAxis of both surfaces line up. I’m trying to sync both surfaces and am using the MouseManager.MouseEventGroup to do it. I set the Chart modifiers for the top chart in xaml like this:

<s:SciChartSurface.ChartModifier>
<s:ModifierGroup s:MouseManager.MouseEventGroup="MyCustomGroup">
<s:AnnotationCreationModifier x:Name="annotationCreation" AnnotationCreated="OnAnnotationCreated" YAxisId="Y1"/>
<s:XAxisDragModifier ClipModeX="None" />
<s:YAxisDragModifier IsEnabled="True" ReceiveHandledEvents="True" AxisId="Y1"/>
<s:ZoomPanModifier IsEnabled="True" ReceiveHandledEvents="True" />
<s:CursorModifier IsEnabled="{Binding ShowCursor}" ShowAxisLabels="False" ShowTooltip="True" ReceiveHandledEvents="True" />
<s:MouseWheelZoomModifier ReceiveHandledEvents="True" />
<s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>

and the bottom chart is created in the view model like this:

var scs = new SciChartSurface();
scs.XAxis = new CategoryDateTimeAxis() { DrawMajorGridLines = false, DrawMinorGridLines = false, AutoRange = AutoRange.Never,VisibleRange = ChartVisibleRange};
scs.YAxis = new NumericAxis() { Id = "Y1", DrawMajorGridLines=false,DrawMinorGridLines=false };
scs.Style = (System.Windows.Style)this.chartForm.sciChartControl.Resources["SciChartSurfaceStyle"];
SciChartGroup.SetVerticalChartGroup(scs, "myGroup");
var _chartModifiers = new ModifierGroup();

                MouseManager.SetMouseEventGroup(_chartModifiers, &quot;MyCustomGroup&quot;);

                ChartModifierBase[] chmodColl = this.GetDefaultChartModifiers();
                foreach (ChartModifierBase chmod in chmodColl)
                {
                    _chartModifiers.ChildModifiers.Add(chmod);

                }
                scs.ChartModifier = _chartModifiers;

and the function returning chartmodifiers returns

private ChartModifierBase[] GetDefaultChartModifiers()
{
var chartModifiers = new ChartModifierBase[7];

        XAxisDragModifier xAxisModifier = new XAxisDragModifier();
        xAxisModifier.ClipModeX = ClipMode.None;

        ZoomPanModifier zModifier = new ZoomPanModifier();
        zModifier.IsEnabled = true;
        zModifier.ReceiveHandledEvents = true;

        MouseWheelZoomModifier mwzoom = new MouseWheelZoomModifier();
        mwzoom.ReceiveHandledEvents = true;

        ZoomExtentsModifier zEModifier = new ZoomExtentsModifier();
        zEModifier.ExecuteOn = ExecuteOn.MouseDoubleClick;

        CursorModifier curModifier = new CursorModifier();
        curModifier.IsEnabled = false;
        curModifier.ShowAxisLabels = true;
        curModifier.ShowTooltip = false;
        curModifier.ReceiveHandledEvents = true;


        SeriesValueModifier serModifier = new SeriesValueModifier();
        //serModifier.YAxisId = &quot;Y1&quot;;
        serModifier.IsEnabled = true;

        AnnotationCreationModifier annoModifier = new AnnotationCreationModifier();
        annoModifier.YAxisId = &quot;Y1&quot;;
        annoModifier.IsEnabled = true;
        annoModifier.AnnotationCreated += annoModifier_AnnotationCreated;

        chartModifiers[0] = xAxisModifier;
        chartModifiers[1] = zModifier;
        chartModifiers[2] = mwzoom;
        chartModifiers[3] = zEModifier;
        chartModifiers[4] = curModifier;
        chartModifiers[5] = annoModifier;
        chartModifiers[6] = serModifier;

        return chartModifiers;
    }

The problem is both the charts don’t seem to be synchronised. When I zoom/pan the top chart, nothing happens in the MACD chart and vice versa. What am I doing wrong here ?

I have attached a screenshot of my application. Thanks for patiently answering all my queries so far, you guys are awesome.

Images
  • You must to post comments
0
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • Andrew Burnett-Thompson
    Hey by the way, you should consider using BandSeries for the MACD with semi-transparent band colors - as then you can get a shaded polygon between the two lines which changes colour depending on whether the MACD signal line is above/below the other. Best regards, Andrew
  • deepakb1
    Thanks Andrew, that worked like a charm. I will look into the BandSeries as well. Deepak
  • You must to post comments
Showing 1 result
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