Pre loader

Error SciChart3DSurface.ExportToFile

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

Hello,

I am trying to export my 3D chart to a file using SciChart3DSurface.ExportToFile. However, I am getting this error:

InvalidOperationException: There was an error reflecting property ‘InputBindings’.

Code behind:

var surface = ResultTestContent.Positional6DOFErrorTestPage.PositionalChart;
surface.ExportToFile($@"C:\temp\ChartTest.jpeg", SciChart.Core.ExportType.Jpeg, true,new Size(800,800));

XAML:

<s3D:SciChart3DSurface x:Name="PositionalChart" Grid.Column="1" ShowLicensingWarnings="True"
                    IsFpsCounterVisible="False"
                     IsAxisCubeVisible="True"
                     IsXyzGizmoVisible="False"
                     CoordinateSystem="RightHanded"
                           Background="White"
                           DebugWhyDoesntSciChartRender="True" RenderableSeries="{extensions:SeriesBinding RenderSeries3DViewModels}"
                           Visibility="Collapsed">

        <!-- Create XAxis -->
        <s3D:SciChart3DSurface.XAxis>
            <s3D:NumericAxis3D TickTextBrush="Black" AxisTitle="X (mm)" DrawMajorBands="True" DrawMajorGridLines="True"
                    DrawMinorGridLines="False"
                    DrawMajorTicks="True"
                    DrawMinorTicks="True"
                               MajorGridLineStyle="{StaticResource ResourceKey=MajorGridLineStyle}"
                               MinorGridLineStyle="{StaticResource ResourceKey=MinorGridLineStyle}"
                    AxisBandsFill="LightCyan"
                    FontSize="10"
                    TickLabelAlignment="Camera"
                               GrowBy="0.1, 0.1"/>
        </s3D:SciChart3DSurface.XAxis>
        <!-- Create YAxis -->
        <s3D:SciChart3DSurface.YAxis>
            <s3D:NumericAxis3D AxisTitle="Z (mm)" MajorGridLineStyle="{StaticResource ResourceKey=MajorGridLineStyle}"
                               MinorGridLineStyle="{StaticResource ResourceKey=MinorGridLineStyle}"
                               DrawMinorGridLines="False"
                    AxisBandsFill="LightCyan"
                    TickTextBrush="Black"
                    FontSize="10"
                    TickLabelAlignment="Camera"
                               GrowBy="0.1, 0.1"/>
        </s3D:SciChart3DSurface.YAxis>
        <!-- Create ZAxis -->
        <s3D:SciChart3DSurface.ZAxis>
            <s3D:NumericAxis3D AxisTitle="Y (mm)" MajorGridLineStyle="{StaticResource ResourceKey=MajorGridLineStyle}"
                               MinorGridLineStyle="{StaticResource ResourceKey=MinorGridLineStyle}"
                               DrawMinorGridLines="False"
                    AxisBandsFill="LightCyan"
                    TickTextBrush="Black"
                    FontSize="10"
                    TickLabelAlignment="Camera"
                               GrowBy="0.1, 0.1"/>
        </s3D:SciChart3DSurface.ZAxis>

        <!-- Create Interactivity Modifiers for rotating camera -->
        <s3D:SciChart3DSurface.ChartModifier>
            <s3D:ModifierGroup3D>
                <s3D:OrbitModifier3D ExecuteOn="MouseLeftButton" ExecuteWhen="None"/>
                <s3D:MouseWheelZoomModifier3D MouseWheelSensitivity="90" />
                <s3D:FreeLookModifier3D ExecuteOn="MouseRightButton"/>
                <s3D:TooltipModifier3D IsEnabled="True" SourceMode="AllSeries" ShowTooltipOn="MouseOver"/>
            </s3D:ModifierGroup3D>
        </s3D:SciChart3DSurface.ChartModifier>
    </s3D:SciChart3DSurface>

I’ve removed the binding from the xaml, yet I am still getting the same issue. Any help is appreciated, thanks.

Version
6.1.0.13075
  • You must to post comments
0
0

Hi Josh

Can you try without the Size and useXamlRenderSurface parameter? I’m not sure but I dont think the 3D chart actuall supports Export at specific size. It definitely does not support useXamlRenderSurface

So your call would look like this:

surface.ExportToFile($@"C:\temp\ChartTest.jpeg", SciChart.Core.ExportType.Jpeg);

Let me know if this helps

Best regards,
Andrew

  • Josh Sewnath
    Unfortunately that didn’t work, it appears that the public property InputBindings on the SciChart3DSurface is not serializable, causing the ExportToFile call to crash.
  • You must to post comments
0
0

Hi,

Thanks for the fast response! Unfortunately that didn’t work. There is no overload for SciChart3DSurface.ExportToFile that takes only 2 arguments.

I’ve just set useXamlRenderSurface to false like this:

surface.ExportToFile($@"C:\temp\ChartTest.jpeg", SciChart.Core.ExportType.Jpeg, false);

Here is the new Error:

System.InvalidOperationException: ‘UIElement.Measure(availableSize) cannot be called with NaN size.’

Again, all help is appreciated.

  • Chris Kirkman
    I worked on this with Josh and we were able to successfully export to a BitmapSource but that is not ideal given our requirements. Can we send you a test app to try?
  • Andrew Burnett-Thompson
    Hi Chris, I have a suspicion that its an error in our API, given that the 3D surface doesn’t support the same as 2D surface for exporting and printing. The functions ExportToFile and overloaded methods need to be pulled up to SciChartSurface rather than on SciChartSurfaceBase, which is shared between both 2D/3D charts. Export is limited for 3D as we are fully DirectX rendered on this platform. The best we can do is export to a bitmap in memory. It’s pretty easy to then save that bitmap to a file, but not to set its size before exporting…
  • 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