Chart of the Week: Creating a WPF 3D Pie Chart to Display the Biggest Cash Crops in the U.S
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (182).NET Core  (26).NET MAUI  (233)Angular  (115)ASP.NET  (49)ASP.NET Core  (80)ASP.NET MVC  (85)Azure  (42)Black Friday Deal  (1)Blazor  (243)BoldSign  (15)DocIO  (24)Essential JS 2  (108)Essential Studio  (198)File Formats  (73)Flutter  (140)JavaScript  (227)Microsoft  (121)PDF  (86)Python  (1)React  (107)Streamlit  (1)Succinctly series  (131)Syncfusion  (988)TypeScript  (32)Uno Platform  (3)UWP  (3)Vue  (45)Webinar  (54)Windows Forms  (59)WinUI  (72)Word  (18)WPF  (165)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  (154)Chart of the week  (62)Cloud  (16)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (74)Development  (696)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (47)Extensions  (31)File Manager  (8)Gantt  (23)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  (530)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (48)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  (426)Uncategorized  (68)Unix  (2)User interface  (67)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (650)What's new  (355)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Chart of the Week Creating a WPF 3D Pie Chart to Display the Biggest Cash Crops in the U.S

Chart of the Week: Creating a WPF 3D Pie Chart to Display the Biggest Cash Crops in the U.S

Welcome to our Chart of the Week blog series!

Today, we’ll delve into the details of the United States’ six most profitable agricultural commodities according to the Leafly Cannabis Report using the Syncfusion WPF 3D Pie Chart control.

Agricultural commodities, or cash crops, are cultivated to sell and make a profit rather than for personal consumption. Several crops have a substantial economic impact on the U.S. economy due to their extensive cultivation and commercial value. Let’s take a closer look at six of these major cash crops according to the Leafly Cannabis Report:

  • Corn: This versatile crop serves multiple purposes, including being used as animal feed, in ethanol production, and as an ingredient in various foods.
  • Soybeans: These are a vital source of protein for animal feed and are also utilized in producing vegetable oil and industrial products.
  • Hay: This is a primary feed source for livestock, supplying essential nutrients such as carbohydrates, proteins, and fiber. It becomes particularly important when fresh forage is scarce, such as in winter or during dry spells.
  • Wheat: A staple in a healthy diet and a major export commodity. Wheat is used in various food products, including bread, pasta, and cereals.
  • Cotton: This important fiber is used in the textile industry and is a significant oil and animal feed source.
  • Cannabis: Also known as marijuana, this crop is commonly used for recreational and medicinal purposes.

In this blog, we’ll visualize the details of these cash crop harvests using the Syncfusion WPF 3D Pie Chart.

Visualizing the Biggest Cash Crops in the U.S. Using the WPF 3D Pie Chart

Step 1: Collect data about cash crops

First, we need to gather the cash crop data from the Leafly Crops Report. Specifically, we’ll examine the page number 4.

Step 2: Prepare data for the chart

Then, create a CashCropModel class with the properties Category and Value to store the information about cash crop harvest values in the U.S. for 2022.

Refer to the following code example.

public class CashCropModel
    public string Category { get; set; }
    public double Value { get; set; }

    public CashCropModel(string category, double value)
        Category = category;
        Value = value;

Next, configure the CashCropData class with the Data property to create a collection of harvest details for cash crops in the United States.

Refer to the following code example.

public class CashCropData
    public ObservableCollection<CashCropModel> Data { get; set; }

    public CashCropData()
        this.Data = new ObservableCollection<CashCropModel>
             new CashCropModel("Cotton", 7.5),
             new CashCropModel("Corn", 82.6),
             new CashCropModel("Cannabis", 5),
             new CashCropModel("Soybeans", 57.5),
             new CashCropModel("Hay", 19.3),
             new CashCropModel("Wheat", 11.9)

Step 3: Configuring the Syncfusion WPF 3D Chart

Configure the Syncfusion WPF 3D Chart control by following this documentation.

Refer to the following code example.


Step 4: Bind the data to the 3D Pie Chart

Now, we’ll create a Pie Chart to visualize the harvest values of cash crops.

 <chart:PieSeries3D ItemsSource="{Binding Data}" XBindingPath="Category" YBindingPath="Value"/>

In the code example, we’ve bound the ItemsSource, XBindingPath, and YBindingPath properties with the Data, Category, and Value properties, respectively.

Step 5: Customize the chart appearance

Let’s customize the appearance of our WPF 3D Pie Chart to make it more visually appealing and informative.

Customizing the chart angle, size, and series color

We can improve the chart’s size, angle, depth, and color using the Depth, Rotation, Tilt, CircleCoefficient, and Palette properties.

Refer to the following code example.

<chart:SfChart3D Depth="40" Rotation="-20" Tilt="-30">
 <chart:PieSeries3D CircleCoefficient="0.85" Palette="Custom">
      <SolidColorBrush Color="#E6586D"/>
      <SolidColorBrush Color="#199AFB"/>
      <SolidColorBrush Color="#DF76D3"/>
      <SolidColorBrush Color="#A0DB69"/>
      <SolidColorBrush Color="#FEC430"/>
      <SolidColorBrush Color="#F6954F"/>

Customizing the chart title

Adding a title to the chart can help users understand the data being visualized. Here’s how you can customize the chart title.

 <Grid Margin="-300,3,0,10" x:Name="header">
   <ColumnDefinition Width="20"/>
   <ColumnDefinition Width="*"/>
  <StackPanel Orientation="Vertical" Margin="0,10,5,0" Background="#199AFB"/>
  <StackPanel Grid.Column="1" >
   <TextBlock Text="The Six Biggest Cash Crops in the U.S" FontSize="35" FontWeight="SemiBold" Foreground="White"/>
   <TextBlock Text="Crops with the biggest wholesale harvest value in the U.S in 2022(in billions of USD)" FontSize="18" Foreground="Gray"/>

Customizing the chart legend

Refer to the following code to enable and customize the legend.

  <chart:ChartLegend DockPosition="Right" Foreground="White" FontSize="15" IconWidth="18" IconHeight="18" ItemMargin="2"/>
 <chart:PieSeries3D LegendIcon="Circle"/>

Adding data labels

We can enable and customize the chart data label elements, such as the label position, connector line, font size, and connector type.

 <chart:PieSeries3D ConnectorType="Bezier" LabelPosition="Outside">
   <chart:ChartAdornmentInfo3D ShowLabel="True" ShowConnectorLine="True" ConnectorHeight="40" FontSize="13"/>

Enabling the interactive features

The WPF 3D Pie Chart enables us to view data dynamically from the best possible angle using a mouse or touch device with the EnableRotation property.

Refer to the following code example.

<chart:SfChart3D EnableRotation="True">

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

Visualizing the Biggest Cash Crops in the U.S. Using the WPF 3D Pie Chart
Visualizing the Biggest Cash Crops in the U.S. Using the WPF 3D Pie Chart

GitHub reference

For more details, refer to the project on GitHub.


Thanks for reading! In this blog, we have shown how to visualize the harvest details of cash crops in the U.S. using the Syncfusion WPF 3D Pie Chart. We encourage you to follow the steps outlined in this blog and share your valuable feedback in the comments section below.

If you require assistance, please don’t hesitate to contact us via our support forumsupport portal, or feedback portal. We are always eager 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