-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from SyncfusionExamples/TASK-856400_Sample_for_…
…biggest_cash_crop Task -856400 sample for biggest cash crop
- Loading branch information
Showing
10 changed files
with
248 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34031.279 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiggestCashCrop", "BiggestCashCrop\BiggestCashCrop.csproj", "{04238966-782E-4126-8E2C-22289A496147}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{04238966-782E-4126-8E2C-22289A496147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{04238966-782E-4126-8E2C-22289A496147}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{04238966-782E-4126-8E2C-22289A496147}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{04238966-782E-4126-8E2C-22289A496147}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {B6383EF6-A945-4797-BDB2-12A11ED54040} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="BiggestCashCrop.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:BiggestCashCrop" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace BiggestCashCrop | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.SfChart.WPF" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<Window x:Class="BiggestCashCrop.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF" | ||
xmlns:local="clr-namespace:BiggestCashCrop" Loaded="Window_Loaded" | ||
mc:Ignorable="d"> | ||
|
||
<Window.DataContext> | ||
<local:CashCropData/> | ||
</Window.DataContext> | ||
|
||
<Border Margin="50" Padding="10,10,50,20" BorderThickness="3" CornerRadius="10" Background="Black" BorderBrush="#b0b8bf"> | ||
|
||
<Grid> | ||
|
||
<chart:SfChart3D Depth="30" Rotation="-20" Tilt="-40" EnableRotation="True"> | ||
|
||
<chart:SfChart3D.Header> | ||
<Grid Margin="-50,3,0,10" x:Name="header"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="20"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<StackPanel Orientation="Vertical" Margin="0,10,5,0" Background="#199AFB"/> | ||
<StackPanel Grid.Column="1" > | ||
<TextBlock Text="The Six Biggest Cash Crop 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 billion U.S dollars)" FontSize="18" Foreground="Gray"/> | ||
</StackPanel> | ||
</Grid> | ||
</chart:SfChart3D.Header> | ||
|
||
<chart:SfChart3D.Legend> | ||
<chart:ChartLegend DockPosition="Right" Foreground="White" FontSize="15" IconWidth="18" IconHeight="18" ItemMargin="2"/> | ||
</chart:SfChart3D.Legend> | ||
|
||
<chart:PieSeries3D ItemsSource="{Binding Data}" XBindingPath="Category" YBindingPath="Value" CircleCoefficient="0.85" | ||
Palette="Custom" LegendIcon="Circle" ConnectorType="Bezier" LabelPosition="Outside"> | ||
|
||
<chart:PieSeries3D.ColorModel> | ||
<chart:ChartColorModel> | ||
<chart:ChartColorModel.CustomBrushes> | ||
<SolidColorBrush Color="#E6586D"/> | ||
<SolidColorBrush Color="#199AFB"/> | ||
<SolidColorBrush Color="#DF76D3"/> | ||
<SolidColorBrush Color="#A0DB69"/> | ||
<SolidColorBrush Color="#FEC430"/> | ||
<SolidColorBrush Color="#F6954F"/> | ||
</chart:ChartColorModel.CustomBrushes> | ||
</chart:ChartColorModel> | ||
</chart:PieSeries3D.ColorModel> | ||
|
||
<chart:PieSeries3D.AdornmentsInfo> | ||
<chart:ChartAdornmentInfo3D ShowLabel="True" ShowConnectorLine="True" ConnectorHeight="50" | ||
FontSize="13"/> | ||
</chart:PieSeries3D.AdornmentsInfo> | ||
</chart:PieSeries3D> | ||
</chart:SfChart3D> | ||
</Grid> | ||
</Border> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace BiggestCashCrop | ||
{ | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Window_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
this.StateChanged += MainWindow_StateChanged; | ||
} | ||
|
||
private void MainWindow_StateChanged(object? sender, EventArgs e) | ||
{ | ||
if (this.WindowState == WindowState.Minimized) | ||
{ | ||
header.Margin = new Thickness(-50, 3, 0, 10); | ||
} | ||
else if (this.WindowState == WindowState.Maximized) | ||
{ | ||
header.Margin = new Thickness(-400, 3, 0, 10); | ||
} | ||
else if (this.WindowState == WindowState.Normal) | ||
{ | ||
header.Margin = new Thickness(-50, 3, 0, 10); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BiggestCashCrop | ||
{ | ||
public class CashCropModel | ||
{ | ||
public string Category { get; set; } | ||
public double Value { get; set; } | ||
|
||
public CashCropModel(string category, double value) | ||
{ | ||
Category = category; | ||
Value = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BiggestCashCrop | ||
{ | ||
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) | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
# Creating-a-3D-Pie-Chart-for-the-Biggest-Cash-Crop-in-the-U.S | ||
This article explains how to create a 3D pie chart to visualize the biggest cash crops in the US in 2022. | ||
# Creating a 3D Pie Chart for the Biggest Cash Crop in the U.S | ||
|
||
## Description | ||
The [3D pie chart](https://www.syncfusion.com/wpf-controls/charts/wpf-3d-pie-chart) is a visual representation of data that utilizes three dimensions to illustrate the proportions of various parts of a whole. In a 3D pie chart, the slices of the pie are distinguished not only by their angles and areas but also by their depth, resulting in a three-dimensional effect. | ||
|
||
## Customization | ||
We can customize the 3D chart view using properties such as [Depth](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.SfChart3D.html#Syncfusion_UI_Xaml_Charts_SfChart3D_Depth), [Rotation](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.SfChart3D.html#Syncfusion_UI_Xaml_Charts_SfChart3D_Rotation), and [Tilt](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.SfChart3D.html#Syncfusion_UI_Xaml_Charts_SfChart3D_Tilt). Additionally, we can enable dynamic rotation of the chart in three dimensions using the [EnableRotation](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.SfChart3D.html#Syncfusion_UI_Xaml_Charts_SfChart3D_EnableRotation) property. | ||
|
||
We have enhanced the appearance of our chart by customizing pie series appearances using [CircleCoefficient](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.CircularSeriesBase3D.html#Syncfusion_UI_Xaml_Charts_CircularSeriesBase3D_CircleCoefficient) and [Palette](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Charts.ChartSeriesBase.html#Syncfusion_UI_Xaml_Charts_ChartSeriesBase_Palette) properties. | ||
|
||
This article explains how to create a 3D pie chart to visualize the six biggest cash crops in the US for 2022. | ||
<img width="931" alt="Demo" src="https://github.com/SyncfusionExamples/Creating-a-3D-Pie-Chart-for-the-Biggest-Cash-Crop-in-the-U.S/assets/103025761/e7732c6f-8470-424b-85bf-b7126823f612"> | ||
|
||
## Troubleshooting | ||
### Path too long exception | ||
If you are facing a path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project. | ||
|
||
For a step-by-step procedure, refer to the [Biggest Cash Crop in US]() blog post. |