Pre loader

Tag: export

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
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

1 vote
6k views

Hello,

I want my HeatmapColorMap to be part of my chart, so that when I export it, the HeatmapColorMap is visible on the PNG / XPS.
In order to this, I put the HeatmapColorMap inside a CustomAnnotation.
I can see it nicely on my Surface but when I try to export it as XPS or as PNG with some specific size, the numbers and ticks have disappeared, only leaving the rectangle with color gradient (see attached picture)
Is there a way to solve this ?

Thank you !

0 votes
3k views

Hello,

On our SciChart’s XAxis we are using a NumericAxis and within the NumericAxis we bind to a LabelProvider. In the UI, this works perfectly and we get the XAxis appearing with the titles we desire (as strings writing over the numeric values 0, 1, 2, …). Meanwhile the YAxis doesn’t use any LabelProvider and stays numeric. The XAxis.LabelProvider is an IList of strings.

Although this works great in the UI, when I export the SciChart it does not pick up the LabelProvider and the exported image only contains the numeric values 0, 1, 2, … on the XAxis.

I do the export as following:

SciChartSurfaceBase.ExportToFile(filename, SciChart.Core.ExportType.Png, useXamlRenderSurface, exportedSize);

Is there a way to get the ExportToFile command to acknowledge the LabelProvider is there like it does with the UI?

Thank you!
Hannah

0 votes
11k views

Hey all,

is there a way on iOS to export a SciChartSurface to a vector format in order to embed the exported chart into a PDF document? Right now the only thing I can find in the Documentation is exportToUIImage(). If not – any ideas for a workaround until such feature is implemented?

1 vote
7k views

Hi,

I have issue with export SciChart to Bitamp. I have to generate pdf report from data. Report contains two charts.

It is possible to render chart in memory and export to bitmap? I know it is possible in WPF but I couldn’t achive this in Android.

Now my solution is that I render this charts on fragments and wait 1s on each to render and then save chart. But this solution is not good. For slower devices chart is not exported correctly.

For example on one device have strange grid (only exported bitmap, fragment with this chart looks good):

Chart

  • Marcin K asked 6 years ago
  • last active 6 years ago
0 votes
6k views

Hi,

I’m trying to export my graphs using the XamlRenderSurface and the ExportToXPS extension function.

I can export a BitmapImage from it fine but the xps image only has the Axis lines and a vertical annotation on it. See images for comparison.

Also, it outright crashes in some other graphs I have on Get MinorDelta because of a null reference exception, no additional info is given out by DebugWhySciCharDoesntRender = true. Likewise in this case, I can export to bitmap just fine. I am using custom tick providers.

I should also note that I’m rendering the charts from memory they’re not visually displayed when export them.

  • kewur asked 7 years ago
  • last active 7 years ago
1 vote
15k views

Hi,

Can we export the chart data to csv format like shown below from the XyDataSeries

DateTime Series1 Series 2

06/23/2015 10 20

Thanks in Advance

Showing 7 results

Try SciChart Today

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

Start TrialCase Studies