How to create Pie-chart and Bar-chart in WinRT/C++ application

Shyam Butani 285 Reputation points
2024-10-08T10:59:06.88+00:00

Hello,

I'm working on Windows Desktop Application with Xaml Island. I want to create and show charts (Pie chart and Bar chart) in my application. I'm not able to find any strait forward way to do this.

Can you give some suggestion on artifacts/api/third-party-libraries that I can use for this?

Thanks.

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
798 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 9,866 Reputation points Microsoft Vendor
    2024-10-09T01:27:01.3833333+00:00

    Hello,

    Welcome to Microsoft Q&A!

    You could use win32 api to create and show charts.

    The primary function used to draw pie charts is the AngleArc function. You could refer to the Doc:Drawing a Pie Chart

    If you want to create a Bar chart you could try to use Rectangle function.

    Thank you.

    Jeanine


  2. Castorix31 86,046 Reputation points
    2024-10-09T01:32:10.3933333+00:00

    There are free Nuget packages like LiveCharts2 or OxyPlot (H.OxyPlot.WinUI).

    Test with H.OxyPlot.WinUI :

    User's image

    Or you can draw them yourself with PathFigure class or Direct2D/Win2D


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.