Free Charting Library and GPU Acceleration in C# Windows Forms
Many chart drawing libraries can be found in the Nuget package manager of the Visual Studio 2022 software, but if you visit the actual development company site, you may find that there are restrictions on functions if you use it for free or that the company has a paid policy that requires payment if you use it. As an alternative, I would like to introduce the chart library officially supported by Microsoft and other freely available chart libraries.
Visual Studio 2022 > Manage Nuget Packages ...
- Many chart libraries can be downloaded, but they are paid or have functional limitations.
microsoft charts
The chart control provided by Microsoft has the following features.
- Chart control cannot be used in WPF and general Windows Forms App projects.
- Chart control can be used in a Windows Forms App project, but the project must be created with
.NET Framework
. - Of course, since it is a Windows Forms App project, GPU acceleration cannot be used in drawing operations.
.NET Framework VS .NET
Originally, Microsoft mainly supported .NET Framework for Windows support and .NET Core for cross-platform, but in 2020, .NET Framework 4.8.1 was the last version and integrated .NET Framework and .NET Core into a new system called .NET. I applied by name. As of 2024, .NET 8.0 version is the latest.
When creating a project, select Windows Forms App (.NET Framework)
.
Visual Studio 2022 - Create Project
And select .NET Framework 4.8
in Framework. Version 4.8 is the last version of the .NET Framework.
Visual Studio 2022 - Select .NET Framework 4.8
If the project has been created successfully, you can see that the Chart control is available in the Data section of the Form Designer.
Visual Studio 2022 - Form Designer
Using GPU Acceleration - SharpDX
By default, GPU acceleration is not available in Windows Forms App. However, using the SharpDX library, you can use GPU acceleration through DirectX.
Referring to the blog post below, it did not seem simple because Windows Forms App requires additional processing while GPU acceleration is available by default in WPF. I will write and share a class for easy GPU use when using Microsoft Charts.
- https://luckygg.tistory.com/389