Pre loader

custom ViewportManager for 3D plots

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 am trying to implement a custom ViewportManager for a SciChart3DSurface, but the overridden methods, such as OnCalculateNewXRange are not called after I assign the custom ViewportManager to a surface. The minimalistic version of my code is:

public class Test3DViewportManager : ViewportManager3DBase
    {
    public Test3DViewportManager() : base()
        {           
        }

    public override void OnParentSurfaceRendered(ISciChart3DSurface sciChartSurface)
        {
        base.OnParentSurfaceRendered(sciChartSurface);
        }

    protected override IRange OnCalculateNewXRange(IAxis3D xAxis)
        {
        return base.CalculateAutoRange(xAxis);
        }


    protected override IRange OnCalculateNewYRange(IAxis3D yAxis, RenderPassInfo3D renderPassInfo)
        {
        return base.CalculateAutoRange(yAxis);
        }


    protected override IRange OnCalculateNewZRange(IAxis3D zAxis, RenderPassInfo3D renderPassInfo)
        {
        return base.CalculateAutoRange(zAxis);
        }
    }

I tried to assign the custom manager is two different ways in code-behind, none of them work:

var VM= new Test3DViewportManager();
SciChart.ViewportManager = VM;  // way 1
VM.AttachSciChartSurface(SciChart); // way 2    

I would appreciate any suggestion, thanks in advance!

Version
6.1.1
  • You must to post comments
0
0

Hi there,

Definitely you want to use Way 1

var VM= new Test3DViewportManager();
SciChart.ViewportManager = VM;  // way 1

However, the methods in ViewportManager will not be called when you assign to a SciChartSurface, but when the SciChart3DSurface is drawn and when axis auto ranges.

Have you set Axis.AutoRange in your application? If you set Axis.AutoRange = Never it will never call this method (as this method is part of autoranging).

If you set Axis.AutoRange = Once it will be called once when the chart is shown.

If you set Axis.AutoRange = Always it will be called every time the chart is drawn.

Best regards,
Andrew

  • You must to post comments
0
0

Hi Andrew,

I thought that AutoRange should have an effect too but, unfortunately, neither of the options works in my case. Here is the XAML code that I use and still the overridden methods are not called (apart of the constructor).

<s3D:SciChart3DSurface x:Name="SciChart" Grid.Column="1" BorderThickness="0" WorldDimensions="200,100,200">
        <s3D:SciChart3DSurface.Camera>
            <s3D:Camera3D ZoomToFitOnAttach="True"/>
        </s3D:SciChart3DSurface.Camera>

        <s3D:SciChart3DSurface.RenderableSeries>
            <s3D:ScatterRenderableSeries3D x:Name="ScatterSeries3D">
                <s3D:ScatterRenderableSeries3D.PointMarker>
                    <s3D:EllipsePointMarker3D Fill="#77ADFF2F" Size="1.0" Opacity="1"/>
                </s3D:ScatterRenderableSeries3D.PointMarker>
            </s3D:ScatterRenderableSeries3D>
        </s3D:SciChart3DSurface.RenderableSeries>

        <s3D:SciChart3DSurface.XAxis>
            <s3D:NumericAxis3D GrowBy="0.1,0.1" AutoRange="Always"/>
        </s3D:SciChart3DSurface.XAxis>

        <s3D:SciChart3DSurface.YAxis>
            <s3D:NumericAxis3D GrowBy="0.1,0.1" AutoRange="Always"/>
        </s3D:SciChart3DSurface.YAxis>

        <s3D:SciChart3DSurface.ZAxis>
            <s3D:NumericAxis3D GrowBy="0.1,0.1" AutoRange="Always"/>
        </s3D:SciChart3DSurface.ZAxis>

    </s3D:SciChart3DSurface>

I attached here the test project.

  • 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