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

Shyam Butani 355 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 development Windows App SDK
{count} votes

2 answers

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    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 90,681 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.