Pre loader

Running SciChart WPF on Linux? It’s possible, here’s how

Categories

Running SciChart WPF on Linux? It’s possible, here’s how

Over the years the question has cropped up many times “Can you run SciChart on Linux?”

SciChart – a cross platform chart library with implementations for Windows Presentation Foundation (WPF), JavaScript, as well as native iOS (Swift/Objective-C) and Android (Java/Kotlin) is based on a proprietary C++ rendering engine codenamed Visual Xccelerator®. This provides the speed, performance that SciChart is well known for, but also a secondary benefit is this engine brings a single shared codebase across platforms for drawing high performance scientific, financial & medical charts & graphs with hardware acceleration in DirectX, OpenGL, Metal and WebGL.

As of yet, there is no pure C++ version of SciChart that could run in say, Qt, however, we have been making steps towards Linux support for SciChart.

Read on to learn how…

Why SciChart on Linux?

WPF applications are typically Windows applications, as they require Microsoft .NET and the Windows Presentation Foundation to run. However, a subset of extremely demanding scientific, financial or medical applications require charts that run on Linux. This could be for:

  • Embedded systems
  • Custom portable hardware
  • Electronic test equipment
  • Radio Frequency or Spectrum Analyzers
  • Oscilloscopes
  • Terminals or kiosks in factories, industrial processes or oil rigs
  • Maritime vessel instrumentation
  • Aircraft instrumentation

By running Linux on an embedded system the cost basis goes down significantly for manufacturers of embedded devices, who won’t have to pay for a Windows license.

In addition, the RTOS (real time operating system) nature of Linux makes it perfect for high performance, critical embedded systems which require high performance, big-data or real-time charts.

Can WPF Run on Linux?

Microsoft introduced .NET Core in 2014, later superseded by .NET, which aimed to be a cross platform implementation of the .NET Framework. It’s no secret that C# code and .NET has been able to run on Linux (and macOS) for many years, but what about WPF?

According to Microsoft official sources, WPF is only for Windows, as this part of the framework was not ported over to Linux. However, the geniuses at Avalonia have actually achieved something astonishing: they’ve managed to make a completely cross platform framework called Avalonia XPF, a version of the Windows Presentation Foundation that runs using OpenGL instead of DirectX.

What is Avalonia XPF?

Avalonia XPF is a proprietary, cross-platform implementation of Windows Presentation Foundation (WPF) brought to you by the developers of Avalonia UI. This enables full WPF compatibility of legacy and existing applications but allows them to run on Windows, Linux and macOS. It achieves this by substituting the DirectX and MilCore Windows specific functions and routines in WPF for equivalents in OpenGL and C++. The result is, existing WPF applications can be ported to run on Linux, often without any code change and in minutes.

It can’t be stressed enough what an enormous timesaver this is for teams who have large existing WPF applications that want to target multiple platforms.

Introducing SciChart for Avalonia XPF

SciChart has been working with the Avalonia team for some time, to bring you an Avalonia XPF compatible version of SciChart WPF that will run on Linux.

Here’s what we’ve done / how we’ve done it:

  • Our C++ Visual Xccelerator® engine has been retargeted to Linux and is compiled using CMake
  • We’ve swapped out all the DirectX rendering in SciChart, for dynamic choosing of DirectX or OpenGL depending on platform.
  • We’ve built a side-by side solution for SciChart WPF that will run targeting Avalonia XPF, as well as the existing .NET Framework, .NET 6,7,8 etc…
  • The examples app & demos have all been tested in the new environment.

It’s important to state we had to make almost no code changes to SciChart WPF itself, and no changes to the API. This is a fully 100% compatible version of SciChart that just magically works on Linux, when targetting Avalonia XPF.

Early Preview – SciChart for XPF on Linux

Below, here’s a video of SciChart for Avalonia XPF running on Linux.

We’re using Visual Studio Code to compile the examples / demo application, and run a number of examples inside an Ubuntu VM.

It’s important to note this is the exact same code, and API as SciChart WPF for Windows, meaning your Windows applications will be compatible and able to run on Linux when targeting Avalonia XPF.

The first demo is the Spectrogram (Spectrum Analyzer) demo, showing the real-time capabilities of SciChart for real-time charts on Linux, followed by the ECG Monitor demo, a real-time medical vital signs monitor.

We then showcase the Digital Analyzer Performance demo – a big data demo which loads multiple channels of digital data each with millions (or even hundreds of millions) of data-points. Useful for creating Logic Analyzer hardware.

At the time of writing, all the 2D examples have been enabled. 3D charts and examples also work however we have one or two bugs to work out before releasing them.

Here’s a few more screenshots of SciChart WPF running on Linux using Avalonia XPF.

Vertically Stacked Axis ECG Charts on Linux
Waterfall Chart demo on Linux
Parallel Coordinate Plot on Linux
Stacked Column and Bar Charts on Linux

Beta Version

A BETA version of SciChart for Avalonia XPF, with 100% compatible code and API to SciChart WPF will be available soon.

We’re going to be publishing a BETA with the demos example application that you can run on both Windows and Linux under the Avalonia XPF framework.

Pricing and Licensing is to be announced, but during the BETA phase we will be making long-term trials available to customers of SciChart WPF in order to try out and provide feedback.

By Andrew Burnett-Thompson | Jun 30, 2024
CEO / Founder of SciChart. Masters (MEng) and PhD in Electronics & Signal Processing.Follow me on LinkedIn for more SciChart content, or twitter at @drandrewbt.

Leave a Reply