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

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.