Chart of the Week: Creating a WPF Bar Chart to Visualize the Homelands of America's International Students
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (181).NET Core  (28).NET MAUI  (227)Angular  (113)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (42)Black Friday Deal  (1)Blazor  (236)BoldSign  (14)DocIO  (24)Essential JS 2  (110)Essential Studio  (200)File Formats  (73)Flutter  (136)JavaScript  (226)Microsoft  (122)PDF  (83)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (964)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (163)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (147)Chart of the week  (58)Cloud  (15)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (73)Development  (681)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (21)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (522)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (45)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (406)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (628)What's new  (341)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Chart of the Week: Creating a WPF Bar Chart to Visualize the Homelands of America's International Students

Chart of the Week: Creating a WPF Bar Chart to Visualize the Homelands of America’s International Students

Welcome to our Chart of the Week blog series!

Today, we embark on an exploration of the U.S.’s international student landscape from the 2022–23 academic year, harnessing the robust capabilities of the Syncfusion WPF Bar Chart. Despite enduring the unprecedented disruptions brought about by the COVID-19 pandemic, colleges and universities across the United States have navigated the challenges regarding the enrollment of international students. Amidst the flux, the academic year 2022–23 stands out with a remarkable resurgence in the international student community, notably propelled by a significant surge in students originating from India.

This resurgence not only underscores the resilience of the U.S. higher education system but also highlights the enduring global appeal of American universities. As we delve deeper into the data, we will uncover intriguing insights into the shifting demographics, enrollment trends, and regional preferences of international students. Through the Syncfusion WPF Bar Chart lens, we aim to provide a visually engaging and informative analysis that illuminates the diverse homelands from which America’s international student community originates.

Following, you’ll find the chart we’ll be constructing.Visualization of the Homelands of America's International Students with the WPF Bar Chart

Let’s craft this bar chart, also known as a transposed column chart.

Step 1: Gathering data on U.S. international enrollment

We must first collect U.S. international enrollment data to kickstart our visualization journey. This data can be sourced from the IIE Open Doors Report.

Step 2: Organizing data for the chart

To represent the countries of origin effectively, define the StudentsModel class with key properties:

  • Country: This property denotes the origin countries of U.S. international students.
  • Count: This property signifies the number of students enrolled during the 2022–2023 academic year.

Refer to the following code example.

public class StudentsModel
     public string Country { get; set; }
     public double Count { get; set; }

     public StudentsModel(string country,  double count)
         Country = country;
         Count = count;

Create a data collection that captures the details of international students in the United States using the StudentsData class with the Data property.

public class StudentsData
      public ObservableCollection<StudentsModel> Data { get; set; }
      public StudentsData() 
          Data = new ObservableCollection<StudentsModel>()
              new StudentsModel("Japan",16054 ),
              new StudentsModel("Nigeria",17640),
              new StudentsModel("Taiwan",21834),
              new StudentsModel("Vietnam",21900),
              new StudentsModel("Canada",27876),
              new StudentsModel("South Korea",43847),
              new StudentsModel("India",268923),
              new StudentsModel("China",289526),

This code initializes the StudentsData class with a collection of StudentsModel instances representing the number of international students from various countries studying in the United States.

Step 3: Configure the Syncfusion WPF Charts control

Let’s configure the Syncfusion WPF Charts control using this getting started documentation.

Refer to the following code example.





Step 4: Bind the U.S. enrollment data to the Bar Chart

Now we’ll craft a bar graph showcasing the homelands of U.S. international students. The following code example illustrates how to connect the gathered data to the chart.

<chart:BarSeries ItemsSource="{Binding Data}" XBindingPath="Country" YBindingPath="Count">

We’ve associated Data with the ItemsSource property in the preceding code. The XBindingPath and YBindingPath properties are also linked to the Country and Count attributes, respectively.

Step 5: Customize the chart’s appearance

To enhance the readability of the plotted data, include a title in the chart. Following is the code demonstrating this.

<chart:SfChart HorizontalHeaderAlignment="Left">

  <Grid Margin="0,0,0,10">
    <RowDefinition Height="*"/>
    <RowDefinition Height="Auto"/>
    <ColumnDefinition Width="13"/>
    <ColumnDefinition Width="*"/>
   <StackPanel Grid.RowSpan="2" Orientation="Vertical" Margin="0,10,0,12" Background="#6987FF"/>

   <StackPanel Grid.Column="1" Margin="3,0,0,0">
    <TextBlock Text="Homelands of America's International Students" FontSize="35" FontWeight="Bold" Foreground="Black"/>
    <TextBlock Text="International enrollment in U.S. higher education in the 2022–23 academic year." FontSize="20"/>

   <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" Margin="20,5,0,5">
    <Rectangle Height="12" Width="30" RadiusX="5" RadiusY="5" Fill="#6987FF" />
    <TextBlock Text="Academics of 2022–23" FontSize="15" Margin="7,0,0,0" />
    <Rectangle Height="12" Width="30" RadiusX="5" RadiusY="5" Fill="#FF6B8F" Margin="7,0,0,0" />
    <TextBlock Text="International students Change from 2021–22 academic year" Margin="7,0,0,0" FontSize="15"/>


Customizing the chart axis

To customize the chart axis, employ the following properties:

  • ShowGridLines: With this property, customize the visibility of the major grid lines.
  • LabelStyle: This property allows you to adjust the style of the axis labels.
  • AxisLineStyle: This property allows you to customize the style of the axis line.
  • MajorTickLineStyle: This property allows you to customize the style of the major tick lines.
  • Visibility: This property allows you to customize the visibility of the axis.
 <chart:CategoryAxis ShowGridLines="False">
   <Style TargetType="Line">
    <Setter Property="StrokeThickness" Value="0"/>

   <Style TargetType="Line">
    <Setter Property="StrokeThickness" Value="0"/>

   <chart:LabelStyle FontSize="13.5"/>

 <chart:NumericalAxis Visibility="Collapsed" ShowGridLines="False" PlotOffsetEnd="25"/>

Customizing the bar color

We can enhance the series’ appearance by customizing the bar’s color, as shown in the following code example.

<chart:BarSeries Interior="#6987FF">

Adding the data labels

To improve the readability of the data, you can enable chart data labels by using the ShowLabel property of AdornmentsInfo.

 <chart:ChartAdornmentInfo ShowLabel="True" LabelPosition="Inner" SegmentLabelFormat="###,###" Foreground="White" FontSize="13" />

Incorporating annotations

The SfChart supports annotations, allowing you to mark specific areas of interest in the chart. Shapes, text, and images can be added using annotations.

Here, we’ll incorporate ellipse and text annotations to illustrate the variation in enrollment between the 2022–23 and 2021–22 academic years.

 <chart:EllipseAnnotation X1="-0.2" X2="0.3" Y1="18000" Y2="26500" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 19.4 %" X1="0.15" Y1="27800" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="0.7" X2="1.25" Y1="19000" Y2="27500" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 22.2 %" X1="1.1" Y1="27800" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="1.8" X2="2.2" Y1="24000" Y2="30500" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 6.6 %" X1="2.1" Y1="31800" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="2.8" X2="3.15" Y1="24000" Y2="30000" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 5.7 %" X1="3.1" Y1="31800" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="3.8" X2="4.05" Y1="30000" Y2="34000" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 3.2 %" X1="4.05" Y1="35800" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="4.8" X2="5.2" Y1="47847" Y2="54847"  Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 7.6 %" X1="5.1" Y1="55647" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="5.6" X2="6.3" Y1="273923" Y2="284423" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="+ 35.0 %" X1="6.05" Y1="285223" FontWeight="SemiBold" FontSize="13.5"/>

 <chart:EllipseAnnotation X1="6.95" X2="7.1" Y1="292026" Y2="294526" Fill="#FF6B8F" Stroke="#FF6B8F"/>
 <chart:TextAnnotation Text="- 0.2 %" X1="7.17" Y1="295326" FontWeight="SemiBold" FontSize="13.5"/>

Adding a watermark

Incorporate a watermark to make the bar chart more informative and attractive. This will allow us to add any view to the chart plot area, which is useful for including relevant data.

 <chart:Watermark Margin="0,50,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
   <Grid Grid.Row="0" >
     <ColumnDefinition Width="Auto"/>
     <ColumnDefinition Width="Auto"/>

    <Path Grid.Column="0" Margin="0,40,48,0" Data="{StaticResource PathData2}" Fill="#6987FF" Stroke="#0c2896" StrokeThickness="0.3">
       <ScaleTransform ScaleX="3.5" ScaleY="3.5"/>

    <Path Grid.Column="1" Margin="25,0,0,0" Data="{StaticResource PathData1}" Fill="#6987FF" Stroke="#0c2896" StrokeThickness="0.3">
       <ScaleTransform ScaleX="3.5" ScaleY="3.5"/>

After executing the previous code examples, the output will look like the following image.

Visualization of the Homelands of America's International Students with the WPF Bar Chart
Visualization of the Homelands of America’s International Students with the WPF Bar Chart

GitHub reference

For more details, refer to the complete project on GitHub.


Thank you for reading! In this blog, we discussed how to visualize the U.S. international student enrollment data in the 2022–2023 school year compared to 2021–2022 using the WPF Bar Chart. We encourage you to follow the steps provided in this blog and share your feedback in the comments section below.

If you need assistance, please do not hesitate to contact us through our support forum, support portal, or feedback portal. We are always ready and willing to help you!

Related blogs


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed