diff --git a/README.md b/README.md index f501f24..7edb91a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # How-to-maintain-a-particular-interval-on-axes-while-zooming-WPF-chart -This sample demonstrate how to maintain a particular interval on axes while zooming WPF chart. +This sample demonstrate how to maintain a particular interval on axes while zooming [WPF chart](https://www.syncfusion.com/wpf-controls/charts). To maintain a specific interval on the axis while zooming a WPF Chart, you can use the EnableAutoIntervalOnZooming property of the chart axis and set it to false. @@ -38,6 +38,10 @@ Before zooming, the x-axis interval is 5, and the y-axis interval is 20. After zooming, the x-axis maintains the same interval, but the y-axis interval has changed. ![Maintain a particular interval on axes while zooming WPF Chart](https://user-images.githubusercontent.com/61832185/214261239-f249591f-457f-463f-a810-ccab391ae90d.png) -## Troubleshooting ## -### Path too long exception -If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project. \ No newline at end of file +## 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 maintain a particular interval on axes while zooming WPF chart](https://support.syncfusion.com/kb/article/12238/how-can-i-keep-the-axis-interval-constant-while-zooming-wpf-chart) diff --git a/SpecificIntervalOnAxis_WPF_Chart/App.config b/SpecificIntervalOnAxis_WPF_Chart/App.config deleted file mode 100644 index 56efbc7..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs b/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs index 1b601b5..1e962a5 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs +++ b/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs @@ -1,17 +1,14 @@ -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 SpecificIntervalOnAxis_WPF_Chart { - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - } + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + } diff --git a/SpecificIntervalOnAxis_WPF_Chart/AssemblyInfo.cs b/SpecificIntervalOnAxis_WPF_Chart/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/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/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml index c2d9313..45ea7a4 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml +++ b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml @@ -3,9 +3,11 @@ 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:local="clr-namespace:SpecificIntervalOnAxis_WPF_Chart" xmlns:chart="http://schemas.syncfusion.com/wpf" + xmlns:local="clr-namespace:SpecificIntervalOnAxis_WPF_Chart" + xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> + @@ -30,4 +32,5 @@ YBindingPath="YValue"/> + diff --git a/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs index 340ef68..9ae5292 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs +++ b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs @@ -1,28 +1,15 @@ -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; +using System.Windows; namespace SpecificIntervalOnAxis_WPF_Chart { - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - } -} + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs b/SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs deleted file mode 100644 index 08ce257..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/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("SpecificIntervalOnAxis_WPF_Chart")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SpecificIntervalOnAxis_WPF_Chart")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[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/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.Designer.cs b/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.Designer.cs deleted file mode 100644 index 8aaebcf..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +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 SpecificIntervalOnAxis_WPF_Chart.Properties -{ - - - /// - /// 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 ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SpecificIntervalOnAxis_WPF_Chart.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/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.resx b/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/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/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.Designer.cs b/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.Designer.cs deleted file mode 100644 index 28d584f..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +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 SpecificIntervalOnAxis_WPF_Chart.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.settings b/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj index c2ee3bf..195e784 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj +++ b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj @@ -1,102 +1,15 @@ - - - + + - Debug - AnyCPU - {761883E6-8469-462A-B222-189827FB55EB} WinExe - SpecificIntervalOnAxis_WPF_Chart - SpecificIntervalOnAxis_WPF_Chart - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true + net9.0-windows + enable + enable + 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/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln index 8441ded..1dbc846 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln +++ b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.4.33213.308 +VisualStudioVersion = 17.12.35527.113 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpecificIntervalOnAxis_WPF_Chart", "SpecificIntervalOnAxis_WPF_Chart.csproj", "{761883E6-8469-462A-B222-189827FB55EB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpecificIntervalOnAxis_WPF_Chart", "SpecificIntervalOnAxis_WPF_Chart.csproj", "{50F04422-EDC0-4C1A-B76E-FC3A50A38C1E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,12 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {761883E6-8469-462A-B222-189827FB55EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {761883E6-8469-462A-B222-189827FB55EB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {761883E6-8469-462A-B222-189827FB55EB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {761883E6-8469-462A-B222-189827FB55EB}.Release|Any CPU.Build.0 = Release|Any CPU + {50F04422-EDC0-4C1A-B76E-FC3A50A38C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {50F04422-EDC0-4C1A-B76E-FC3A50A38C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {50F04422-EDC0-4C1A-B76E-FC3A50A38C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {50F04422-EDC0-4C1A-B76E-FC3A50A38C1E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {85B3F4A6-01B1-4C39-B241-D73F899D48E3} - EndGlobalSection EndGlobal diff --git a/SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs b/SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs index 6a0b513..34b8b09 100644 --- a/SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs +++ b/SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.ObjectModel; + namespace SpecificIntervalOnAxis_WPF_Chart { diff --git a/SpecificIntervalOnAxis_WPF_Chart/packages.config b/SpecificIntervalOnAxis_WPF_Chart/packages.config deleted file mode 100644 index 5c6230c..0000000 --- a/SpecificIntervalOnAxis_WPF_Chart/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file