I’m seeing a delay the first time I add a chart to scichart:SciChartSurface. Subsequent loads are much faster. It looks like the initial initialization is taking time—what can I do to reduce or eliminate this first-load delay?
where ChartDocumentControl
- Karthikeyan Rajendran asked 4 weeks ago
- last edited 4 weeks ago
- You must login to post comments
Hi Karthikeyan,
There’s some information in the SciChart WPF Documentation on Startup Application Performance.
Basically, there’s a 300ms static cost for initializing the SciChart WPF 2D/3D graphics engine (once per application) plus some additional time for first chart creation. This can be done at launch of your application by using this code:
// Edit app.xaml.cs
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// Async load libraries and apply license
//
// This code should be called and awaited before any SciChartSurface or SciChart3DSurface is shown
//
// Use SciChart.Charting3D.SciChart2D3DInitializer if you use both 2D & 3D charts in your app. Note this also initializes 2D libraries
// Use SciChart.Charting.Visuals.SciChart2DInitializer if you use only 2D charts in your app
//
// Options: runtimeLicenseKey should be set to your license key
// tempDirectory is an optional temp directory for loading native libraries. Leave null for the default
string runtimeLicenseKey = "your license keycode here";
string tempDirectory = null;
var initTask = SciChart2D3DInitializer.LoadLibrariesAndLicenseAsync(runtimeLicenseKey, tempDirectory);
// You can either await initTask or use SciChart2D3DInitializer.Awaiter
// to do the same thing later on (see MainWindow.xaml.cs)
}
// Edit mainwindow.xaml.cs (or elsewhere in your application startup)
private async void MainWindowLoaded(object sender, RoutedEventArgs e)
{
// Wait for the license initialization we triggered in App.xaml.cs
await SciChart2D3DInitializer.Awaiter;
// Now swap out content for SciChartSurfaces once lienses loaded
this.root.Children.Clear();
this.root.Children.Add(new SciChartContent());
}
Also, you can find a video tutorial about asynchronous SciChart loading on our YouTube channel and download a sample project from GitHub.
It’s also possible to Asynchronously startup the 2D/3D graphics engine in SciChart WPF version 8 onwards. We do this in our own SciChart WPF demo app while the splash screen is being shown.
// App.xaml.cs
public App()
{
// Start Visual Xccelerator Engine asynchronously
Task.Run(() =>
{
try
{
VisualXcceleratorEngine.UseAutoShutdown = false;
VisualXcceleratorEngine.RestartEngine();
}
catch
{
// Suppress Vx init errors. In this case rendering // will occur with a fallback to a software renderer
}
});
// Do other app initialization
InitializeComponent();
}
For more information, take a look at the Bootstrapper.cs file in the SciChart.Wpf.Examples repository. This shows you how to do this in the most efficient way.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 4 weeks ago
- You must login to post comments
Please login first to submit.

