How to improve the performance while resizing the WPF chart window?
This KB discusses how to improve performance when a window containing SfChart is resized.
The SfChart has a good performance by default, since the UI of SfChart is made to get updated only when the dispatcher thread priority is normal. This prevents the update of the chart when there is a consistent update of chart APIs at application level and the chart is finally updated only after all the APIs are set in the application.
In case of resizing the windows frequently. The chart UI is rendered while the UI thread is free. Thus, when resizing the chart, it is rendered in the fractional time gap i.e., when the mouse is not moved. So that it takes some more time to render the chart, but still the performance can be improved as follows.
The performance can be improved in three different ways.
- Usage of fast bitmap series for the SfChart.
- The performance for the FastLineBitmapSeries can still be improved by reducing its stroke thickness and this can be done by setting the StrokeThickness property as one and disabling its anti – aliasing rendering by setting the EnableAnitAliasing property as false. This prevents the additional series rendering logic and instead uses only Bresenham’s line drawing algorithm.
<syncfusion:FastLineBitmapSeries EnableAntiAliasing="False" StrokeThickness="1" />
- Disabling DPI awareness for the application improves the performance well. DPI awareness is the dots rendered per inch for an image according to screen size. This can be disabled in the AssemblyInfo.cs file as shown in the following code snippet.
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: System.Windows.Media.DisableDpiAwareness]
Disabling DPI awareness may affect the rendering of controls when the application is moved between screens of different resolutions. To know more about DPI awareness in WPF kindly refer to this link.
See also:
Performance in WPF Charts (SfChart)
Conclusion
I hope you enjoyed learning about ow to improve the performance while resizing the WPF chart window.
You can refer to our WPF Chart feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF Chart documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!