Pre loader

FAQ: How to have two YAxis on left and right with the same VisibleRange (mirrored YAxis)

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

Someone recently asked the question on priority support tickets

Q: How do I have two YAxis on the left and right of the chart but with
the same VisibleRange?

e.g. how to mirror the YAxis on both sides of the chart

We are replicating the answer below for benefit of our userbase:

  • You must to post comments
0
0

This can be achieved easily with bindings, the following code should do it:

<s:SciChartSurface>
    <s:SciChartSurface.XAxis>
        <s:NumericAxis/>
    </s:SciChartSurface.XAxis>

    <s:SciChartSurface.YAxes>
        <s:NumericAxis x:Name="primaryAxis" AxisAlignment="Right" AxisTitle="Title" DrawMajorBands="True"/>
        <s:NumericAxis x:Name="secondaryAxis" AxisAlignment="Left" AxisTitle ="Title" Id="SecondaryAxis" VisibleRange="{Binding ElementName=primaryAxis, Path=VisibleRange, Mode=TwoWay}"/>
    </s:SciChartSurface.YAxes>

    <s:SciChartSurface.ChartModifier>
        <s:ZoomPanModifier ClipModeX="None"/>
    </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

Above: the secondary YAxis is not used, you simply treat this as you would a single YAxis chart, except the secondary YAxis.VisibleRange is bound to the primary YAxis.VisibleRange OneWay.

Here is the result:

enter image description here

Update: Bug with ZoomExtentsModifier

One user has pointed out a bug in this implementation. If the ZoomExtentsModifier is used, then the secondary axis does not reset. This has been fixed in SciChart build v3.4.1.6332, now available on our Nightly build feed.

Best regards,
Andrew

Attachments
  • You must to post comments
0
0

How can we do this in the code behind with C# only and no xaml?

  • You must to post comments
Showing 2 results
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