diff --git a/README.md b/README.md index 7340662..7a235fb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # How to create 3D Bar Chart in WPF? -This article explains about how to create a 3D Bar Chart in WPF. +This article explains about how to create a [3D Bar Chart](https://www.syncfusion.com/wpf-controls/charts/wpf-3d-bar-chart) in WPF. You can create 3D bar chart in WPF 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. Populated items are the sales details which denotes the products and their revenue + +**Model** ``` public class Sales @@ -15,6 +17,8 @@ public class Sales } ``` +**ViewModel** + ``` public ViewModel() { @@ -28,6 +32,8 @@ public ViewModel() public ObservableCollection GrowthDetails { get; set; } ``` +**XAML** + ``` @@ -53,4 +59,10 @@ public ObservableCollection GrowthDetails { get; set; } ![3D Bar chart in WPF](https://user-images.githubusercontent.com/53489303/200646561-26af5f1a-f427-4117-920d-75f6e5ddef2c.png) -KB article - [How to create 3D Bar Chart in WPF](https://www.syncfusion.com/kb/11464/how-to-create-3d-bar-chart-in-wpf) +## 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 a shorter name before building the project. + +For more details, refer to the KB on [How to create 3D Bar Chart in WPF](https://www.syncfusion.com/kb/11464/how-to-create-3d-bar-chart-in-wpf) diff --git a/Sample-WPF.sln b/Sample-WPF.sln deleted file mode 100644 index 448d9e6..0000000 --- a/Sample-WPF.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample-WPF", "Sample-WPF\Sample-WPF.csproj", "{36F26733-E90C-436A-9C63-F416942CCCC2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Release-Xml|Any CPU = Release-Xml|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {36F26733-E90C-436A-9C63-F416942CCCC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {36F26733-E90C-436A-9C63-F416942CCCC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {36F26733-E90C-436A-9C63-F416942CCCC2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {36F26733-E90C-436A-9C63-F416942CCCC2}.Release|Any CPU.Build.0 = Release|Any CPU - {36F26733-E90C-436A-9C63-F416942CCCC2}.Release-Xml|Any CPU.ActiveCfg = Release|Any CPU - {36F26733-E90C-436A-9C63-F416942CCCC2}.Release-Xml|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Sample-WPF/App.config b/Sample-WPF/App.config deleted file mode 100644 index 2d2a12d..0000000 --- a/Sample-WPF/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/Sample-WPF/MainWindow.xaml.cs b/Sample-WPF/MainWindow.xaml.cs deleted file mode 100644 index 6f28bf7..0000000 --- a/Sample-WPF/MainWindow.xaml.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Syncfusion.UI.Xaml.Charts; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -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 Sample_WPF -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : UserControl - { - public MainWindow() - { - InitializeComponent(); - } - - } - -} diff --git a/Sample-WPF/Model.cs b/Sample-WPF/Model.cs deleted file mode 100644 index 2f3ed4c..0000000 --- a/Sample-WPF/Model.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Sample_WPF -{ - public class Sales - { - public string Product { get; set; } - - public double Revenue { get; set; } - } -} diff --git a/Sample-WPF/Properties/AssemblyInfo.cs b/Sample-WPF/Properties/AssemblyInfo.cs deleted file mode 100644 index 5a5ee87..0000000 --- a/Sample-WPF/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Sample-WPF")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Sample-WPF")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[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) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Sample-WPF/Properties/Resources.Designer.cs b/Sample-WPF/Properties/Resources.Designer.cs deleted file mode 100644 index f84118d..0000000 --- a/Sample-WPF/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Sample_WPF.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sample_WPF.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Sample-WPF/Properties/Resources.resx b/Sample-WPF/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/Sample-WPF/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Sample-WPF/Properties/Settings.Designer.cs b/Sample-WPF/Properties/Settings.Designer.cs deleted file mode 100644 index 6bc5179..0000000 --- a/Sample-WPF/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Sample_WPF.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Sample-WPF/Properties/Settings.settings b/Sample-WPF/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/Sample-WPF/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Sample-WPF/Sample-WPF.csproj b/Sample-WPF/Sample-WPF.csproj deleted file mode 100644 index 90976bf..0000000 --- a/Sample-WPF/Sample-WPF.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - - Debug - AnyCPU - {36F26733-E90C-436A-9C63-F416942CCCC2} - WinExe - Properties - Sample_WPF - Sample-WPF - v4.6 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - * - - - * - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - \ No newline at end of file diff --git a/Sample-WPF/packages.config b/Sample-WPF/packages.config deleted file mode 100644 index 8730adf..0000000 --- a/Sample-WPF/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Sample-WPF/App.xaml b/Sample_WPF/App.xaml similarity index 100% rename from Sample-WPF/App.xaml rename to Sample_WPF/App.xaml diff --git a/Sample-WPF/App.xaml.cs b/Sample_WPF/App.xaml.cs similarity index 60% rename from Sample-WPF/App.xaml.cs rename to Sample_WPF/App.xaml.cs index 5439146..e61f2da 100644 --- a/Sample-WPF/App.xaml.cs +++ b/Sample_WPF/App.xaml.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Configuration; +using System.Configuration; using System.Data; -using System.Linq; -using System.Threading.Tasks; using System.Windows; namespace Sample_WPF @@ -14,4 +10,5 @@ namespace Sample_WPF public partial class App : Application { } + } diff --git a/Sample_WPF/AssemblyInfo.cs b/Sample_WPF/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/Sample_WPF/AssemblyInfo.cs @@ -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) +)] diff --git a/Sample-WPF/MainWindow.xaml b/Sample_WPF/MainWindow.xaml similarity index 92% rename from Sample-WPF/MainWindow.xaml rename to Sample_WPF/MainWindow.xaml index 080ee6e..66186e3 100644 --- a/Sample-WPF/MainWindow.xaml +++ b/Sample_WPF/MainWindow.xaml @@ -1,12 +1,12 @@ - + Title="MainWindow" Height="450" Width="800"> @@ -26,5 +26,6 @@ - - + + + diff --git a/Sample_WPF/MainWindow.xaml.cs b/Sample_WPF/MainWindow.xaml.cs new file mode 100644 index 0000000..72fc073 --- /dev/null +++ b/Sample_WPF/MainWindow.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows; + +namespace Sample_WPF +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/Sample_WPF/Model.cs b/Sample_WPF/Model.cs new file mode 100644 index 0000000..0445028 --- /dev/null +++ b/Sample_WPF/Model.cs @@ -0,0 +1,9 @@ +namespace Sample_WPF +{ + public class Sales + { + public string Product { get; set; } + + public double Revenue { get; set; } + } +} diff --git a/Sample_WPF/Sample_WPF.csproj b/Sample_WPF/Sample_WPF.csproj new file mode 100644 index 0000000..195e784 --- /dev/null +++ b/Sample_WPF/Sample_WPF.csproj @@ -0,0 +1,15 @@ + + + + WinExe + net9.0-windows + enable + enable + true + + + + + + + diff --git a/Sample_WPF/Sample_WPF.sln b/Sample_WPF/Sample_WPF.sln new file mode 100644 index 0000000..5dc83c8 --- /dev/null +++ b/Sample_WPF/Sample_WPF.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35527.113 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample_WPF", "Sample_WPF.csproj", "{BCBC4B96-1651-4F18-A0DC-E23D0E9F23AB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BCBC4B96-1651-4F18-A0DC-E23D0E9F23AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BCBC4B96-1651-4F18-A0DC-E23D0E9F23AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BCBC4B96-1651-4F18-A0DC-E23D0E9F23AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BCBC4B96-1651-4F18-A0DC-E23D0E9F23AB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Sample-WPF/ViewModel.cs b/Sample_WPF/ViewModel.cs similarity index 76% rename from Sample-WPF/ViewModel.cs rename to Sample_WPF/ViewModel.cs index 4d04653..093cecf 100644 --- a/Sample-WPF/ViewModel.cs +++ b/Sample_WPF/ViewModel.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.ObjectModel; namespace Sample_WPF {