Pre loader

Tag: RenderSurface

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

1 vote
11k views

I cannot figure out how to setup SciChartSurface so that it would be initialized right away and IsSizeValidForDrawing returned true.

Now I have the special case for the first call to the view with SciChartSurface and I start working with it after receiving SizeChanged event. In this event handler and afterwards IsSizeValidForDrawing gets true and later on all my requests to the view are OK. It’s quite inconvenient.

When does SciChartSurface get resized? What makes it resize?
Which moment does IsSizeValidForDrawing get true?
What should I do to make the size valid after instantiating or receiving first bunch of data ?
How can I make it progmammatically?

This is my xaml:

        <s:SciChartSurface.RenderableSeries>
            <s:FastLineRenderableSeries XAxisId="XAxis1" YAxisId="YAxis1" AntiAliasing="False" />
            <s:FastLineRenderableSeries XAxisId="XAxis2" YAxisId="YAxis2" AntiAliasing="False"  />
            <s:FastLineRenderableSeries XAxisId="XAxis1" YAxisId="YAxis1" AntiAliasing="False" />
            <s:FastLineRenderableSeries XAxisId="XAxis2" YAxisId="YAxis2" AntiAliasing="False" />
            <s:FastLineRenderableSeries XAxisId="XAxis1" YAxisId="YAxis1" AntiAliasing="False"/>
            <s:FastLineRenderableSeries XAxisId="XAxis2" YAxisId="YAxis2" AntiAliasing="False"/>
        </s:SciChartSurface.RenderableSeries>

        <s:SciChartSurface.XAxes>
            <s:NumericAxis Id="XAxis1" />
            <s:NumericAxis Id="XAxis2" />
        </s:SciChartSurface.XAxes>

        <s:SciChartSurface.YAxes>
            <s:NumericAxis Id="YAxis1"  />
            <s:NumericAxis Id="YAxis2" />
        </s:SciChartSurface.YAxes>
    </s:SciChartSurface>

    <Grid Grid.Row="1" x:Name="myOverviews">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <s:SciChartOverview  Grid.Row="0" 
                    XAxisId="XAxis1"
                    ParentSurface="{Binding ElementName=mySurface}"
                    DataSeries="{Binding ElementName=mySurface, Path=RenderableSeries[4].DataSeries}"
                    SelectedRange="{Binding ElementName=mySurface, Path=XAxes[0].VisibleRange, Mode=TwoWay}"
                    Visibility ="Collapsed"
                    s:ThemeManager.Theme="BlackSteel">
        </s:SciChartOverview>

        <s:SciChartOverview Grid.Row="1" 
                    XAxisId="XAxis2"
                    ParentSurface="{Binding ElementName=mySurface}"
                    DataSeries="{Binding ElementName=mySurface, Path=RenderableSeries[4].DataSeries}"
                    SelectedRange="{Binding ElementName=mySurface, Path=XAxes[1].VisibleRange, Mode=TwoWay}"
                    Visibility ="Collapsed"
                    s:ThemeManager.Theme="BlackSteel">
        </s:SciChartOverview>
    </Grid>

All visibilities besides SciChartSurface are “Collapsed”

SciChart version 3.1.0.5077

Thank you

0 votes
5k views

My application is crashing only on one machine. I’ve narrowed it down to SciChart as my application doesn’t crash when I’ve removed SciChart from the UI.

At first I assumed it was potentially related to the visual accelerator engine; however, I removed that from my surface style and switched back to HighQualityRenderSurface and it still crashes.

It should be noted that I have not yet displayed anything on the SciChartSurface when this happens.

Here is what I initially had.

<Style x:Key="SurfaceStyle" TargetType="s:SciChartSurface">
    <Setter Property="Background" Value="White"/>
    <Setter Property="Padding" Value="0,0,10,0"/>
    <Setter Property="s:VisualXcceleratorEngine.IsEnabled" Value="True" />
    <Setter Property="s:VisualXcceleratorEngine.DowngradeWithoutException" Value="True" />
    <Setter Property="s:VisualXcceleratorEngine.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
    <Style.Triggers>
        <Trigger Property="componentModel:DesignerProperties.IsInDesignMode" Value="False">
            <Setter Property="s3d:DirectXHelper.TryApplyDirectXRenderer" Value="True" />
            <Setter Property="s3d:DirectXHelper.FallbackType" Value="{x:Type s:HighQualityRenderSurface}" />
        </Trigger>
    </Style.Triggers>
</Style>

This is after I removed the Xccelerator.

<Style x:Key="SurfaceStyle" TargetType="s:SciChartSurface">
    <Setter Property="Background" Value="White"/>
    <Setter Property="Padding" Value="0,0,10,0"/>
    <Setter Property="RenderSurface">
        <Setter.Value>
            <s:HighQualityRenderSurface />
        </Setter.Value>
    </Setter>
</Style>

Any help is greatly appreciated. This is a time sensitive problem. Thanks.

1 vote
11k views

Hi,

I am trying to swap one of our graphs to use the new DX10 surface but are unable to do so.

As per the release notes for the DX10 render functionality we added DX and the SciChart Wpf3d dll’s as references in the project, added the s3D namespace to the XAML and set the render surface to ‘Direct3D10RenderSurface’ but upon starting the application the graph disappear.

In XAML editor we get the warning message on the reference to ‘s3D:Direct3D10RenderSurface’:

‘Could not load type ‘Abt.Controls.SciChart.Wpf.XmlFileSite’ from assembly ‘Abt.Controls.SciChart.Wpf, Version=3.1.0.4549 …..’

We have switched to use the SciChart NuGet feed for the SciChart references.

Is there any more things we need to do in order to enable DX10 RenderSurface ?

Best regards
-Magnus

  • haumag asked 10 years ago
  • last active 10 years ago
0 votes
7k views

Hello,
I am currently using the HighQualityRenderSurface (as seen here: https://support.scichart.com/index.php?/News/NewsItem/View/30) to replace some dynamically drawn maps in an application. I’m wondering if there is a way to make a blended/ gradient brush that can be drawn onto this surface. The application currently uses a three color blended brush drawn onto a WPF canvas.

Edit: Added images as an example of what we are trying to achieve.

zoomed out

zoomed in

1 vote
5k views

Hi SciChart,

We are experiencing a SciChart XPS export issue.

I am using a FlowDocumentPageViewer with a FlowDocument containing SciChart graphs. My goal is to export all pages of the FlowDocument to an XPS file using the XamlRenderSurface to save in vector graphics. However, I’m facing an issue where only the currently selected page exports correctly, while the other pages display empty graphs.

By default, we employ the VisualXcceleratorRenderSurface for all SciChart render surfaces. Before exporting, I programmatically switch them to XamlRenderSurface to save in vector graphics. This approach works well when all the graphs have been rendered on-screen at least once with the new surface type before exporting. However, if a graph hasn’t been rendered on-screen before exporting, it appears empty, and only the graphs from the selected page export correctly. You can find code snippets below.

XAML code:

<s:SciChartSurface
    x:Name="PART_Surface"
    ...
    RenderSurface="{TemplateBinding RenderType, Converter={StaticResource RenderTypeConverter}}"
    ...

Converter:

public class RenderTypeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        // Set render settings
        return (RenderType)value switch
        {
            RenderType.DirectX => new VisualXcceleratorRenderSurface(),
            RenderType.HighQuality => new HighQualityRenderSurface(),
            RenderType.HighSpeed => new HighSpeedRenderSurface(),
            RenderType.Vector => new XamlRenderSurface(),
            _ => new HighSpeedRenderSurface(),
        };
    }
    ...
}

Export:

private void ExportVector(string fullPath)
{
    // Sets the RenderType to Vector for all surfaces
    // This invokes RenderTypeConverter to set the RenderSurface to XamlRenderSurface
    // Since they are bound in the XAML code
    SetAxesSurfacesRenderToVector();

    XPS_Export_AllPagesOfFlowDocument(fullPath);

    // DirectX is always the default for all surfaces that we use
    ResetAxesSurfacesToDirectX();
}
private void XPS_Export_AllPagesOfFlowDocument(string fullPath)
{
    using (var package = Package.Open(fullPath, FileMode.Create))
    {
        using (var xpsDocument = new XpsDocument(package, CompressionOption.Maximum))
        {
            var xpsSerializationManager = new XpsSerializationManager(new XpsPackagingPolicy(xpsDocument), false);
            var documentPaginator = ((IDocumentPaginatorSource)FlowDocument)?.DocumentPaginator;
            xpsSerializationManager.SaveAsXaml(documentPaginator);

            xpsDocument.Close();
        }
    }
}

The binding and the converter works for all offscreen elements, yet the they won’t take effect until rendered on screen at least once.
I have to select each page manually, after setting all graphs to use XamlRenderSurface, so each would be rendered on screen at least once before the export.

My question is: How can I export XamlRenderSurfaces that are off-screen and haven’t been rendered on-screen before the export process?

You can find an image below showcasing the problem.

Thank you and looking forward to your reply!

Best Regards,
Kaloyan Krastev

Showing 5 results

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies