How to create 3D bar Chart in WPF?
You can create 3D bar chart in WPF Chart by populating the items into ItemsSource of BarSeries3D series . In the following example, you will look at a grocery store. The chart displays the revenue generated from the production department.
[C#]
Populated items are the sales details which denotes the products and their revenue.
public class Sales
{
public string Product { get; set; }
public double Revenue { get; set; }
}
public ViewModel()
{
this.GrowthDetails = new ObservableCollection<Sales>();
GrowthDetails.Add(new Sales { Product ="Pears", Revenue = 10245 });
GrowthDetails.Add(new Sales { Product ="Apples", Revenue = 14567 });
GrowthDetails.Add(new Sales { Product ="Tomatoes", Revenue = 32456 });
GrowthDetails.Add(new Sales { Product ="Peas", Revenue = 31245 });
}
public ObservableCollection<Sales> GrowthDetails
{
get; set;
}
[XAML]
<Syncfusion:SfChart3D x:Name="Chart" Header="3D Bar Chart "> <Syncfusion:SfChart3D.DataContext> <local:ViewModel/> </Syncfusion:SfChart3D.DataContext>
<Syncfusion:SfChart3D.PrimaryAxis> <Syncfusion:CategoryAxis3D Header="Products"/> </Syncfusion:SfChart3D.PrimaryAxis> <Syncfusion:SfChart3D.SecondaryAxis> <Syncfusion:NumericalAxis3D Header="Revenue"/> </Syncfusion:SfChart3D.SecondaryAxis> <Syncfusion:BarSeries3D ItemsSource="{Binding GrowthDetails}" XBindingPath="Product" YBindingPath="Revenue"> <Syncfusion:BarSeries3D.AdornmentsInfo> <Syncfusion:ChartAdornmentInfo3D AdornmentsPosition="TopAndBottom" ShowLabel="true" HighlightOnSelection="True"/> </Syncfusion:BarSeries3D.AdornmentsInfo> </Syncfusion:BarSeries3D> </Syncfusion:SfChart3D >
Output
For more details, please refer to the project on GitHub.
See Also
What are the available 3D chart types in WPF
Possible interaction available in 3D chart
Conclusion
I hope you enjoyed learning how to create 3D bar Chart in WPF.
You can refer to our WPF Chart feature tour page know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Chart Examples to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
