From 1693e58849b2fe9a7b29aa5fa3e897c918680845 Mon Sep 17 00:00:00 2001 From: Naveenkumar S Date: Tue, 24 Jan 2023 15:26:29 +0530 Subject: [PATCH 1/2] Added sample to maintain a particular interval on axes --- README.md | 41 ++++++ SpecificIntervalOnAxis_WPF_Chart/App.config | 6 + SpecificIntervalOnAxis_WPF_Chart/App.xaml | 9 ++ SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs | 17 +++ .../MainWindow.xaml | 33 +++++ .../MainWindow.xaml.cs | 28 +++++ .../Properties/AssemblyInfo.cs | 55 ++++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ .../Properties/Resources.resx | 117 ++++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 ++ .../SpecificIntervalOnAxis_WPF_Chart.csproj | 102 +++++++++++++++ .../SpecificIntervalOnAxis_WPF_Chart.sln | 25 ++++ SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs | 37 ++++++ .../packages.config | 5 + 15 files changed, 583 insertions(+) create mode 100644 SpecificIntervalOnAxis_WPF_Chart/App.config create mode 100644 SpecificIntervalOnAxis_WPF_Chart/App.xaml create mode 100644 SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml create mode 100644 SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.Designer.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.resx create mode 100644 SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.Designer.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.settings create mode 100644 SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj create mode 100644 SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln create mode 100644 SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs create mode 100644 SpecificIntervalOnAxis_WPF_Chart/packages.config diff --git a/README.md b/README.md index dc3e4eb..f501f24 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # 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. + +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. + +Additionally, you can add the ChartZoomPanBehavior to the charts’ behavior collection and set the desired interval (in this case, 5) on the axis. This will ensure that the axis interval remains consistent during zoom operations. + +The following code sample demonstrates this implementation. + +**[XAML]** + +``` + + + + + + + + + + + + + + + + + +``` +## Output: + +Before zooming, the x-axis interval is 5, and the y-axis interval is 20. +![Before zooming a WPF Chart](https://user-images.githubusercontent.com/61832185/214261220-787f7eef-57b9-4c86-9c0d-823382411e42.png) + +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 diff --git a/SpecificIntervalOnAxis_WPF_Chart/App.config b/SpecificIntervalOnAxis_WPF_Chart/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SpecificIntervalOnAxis_WPF_Chart/App.xaml b/SpecificIntervalOnAxis_WPF_Chart/App.xaml new file mode 100644 index 0000000..6b90ac1 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs b/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs new file mode 100644 index 0000000..1b601b5 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/App.xaml.cs @@ -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 SpecificIntervalOnAxis_WPF_Chart +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml new file mode 100644 index 0000000..c2d9313 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs new file mode 100644 index 0000000..340ef68 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +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 SpecificIntervalOnAxis_WPF_Chart +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs b/SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..08ce257 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +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 new file mode 100644 index 0000000..8aaebcf --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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 new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 0000000..28d584f --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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 new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj new file mode 100644 index 0000000..c2ee3bf --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.csproj @@ -0,0 +1,102 @@ + + + + + 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 + + + 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 new file mode 100644 index 0000000..8441ded --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/SpecificIntervalOnAxis_WPF_Chart.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpecificIntervalOnAxis_WPF_Chart", "SpecificIntervalOnAxis_WPF_Chart.csproj", "{761883E6-8469-462A-B222-189827FB55EB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + 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 + 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 new file mode 100644 index 0000000..6a0b513 --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/ViewModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpecificIntervalOnAxis_WPF_Chart +{ + public class ViewModel + { + public ObservableCollection Data { get; set; } + + public ViewModel() + { + Data = new ObservableCollection() + { + new Model() {XValue=5, YValue = 5}, + new Model() {XValue=10,YValue = 35}, + new Model() {XValue=15,YValue = 80}, + new Model() {XValue= 20,YValue = 120}, + new Model() {XValue=25,YValue = 140}, + new Model() {XValue=30, YValue = 120}, + new Model() {XValue=35,YValue = 80}, + new Model() {XValue=40,YValue = 35}, + new Model() {XValue= 45,YValue = 5}, + }; + + } + } + + public class Model + { + public double XValue { get; set; } + public double YValue { get; set; } + } +} diff --git a/SpecificIntervalOnAxis_WPF_Chart/packages.config b/SpecificIntervalOnAxis_WPF_Chart/packages.config new file mode 100644 index 0000000..5c6230c --- /dev/null +++ b/SpecificIntervalOnAxis_WPF_Chart/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 399feba0a4883c9f28ee0733fa83ce433a7354b5 Mon Sep 17 00:00:00 2001 From: SyncfusionBuild <89958145+SyncfusionBuild@users.noreply.github.com> Date: Tue, 24 Jan 2023 16:18:26 +0530 Subject: [PATCH 2/2] Gitleaks action file added --- .github/workflows/gitleaks.yaml | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/gitleaks.yaml diff --git a/.github/workflows/gitleaks.yaml b/.github/workflows/gitleaks.yaml new file mode 100644 index 0000000..48a24dd --- /dev/null +++ b/.github/workflows/gitleaks.yaml @@ -0,0 +1,38 @@ +name: Secret Value found! +on: + push: + public: +jobs: + scan: + name: gitleaks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install the gitleaks + run: wget https://github.com/zricethezav/gitleaks/releases/download/v8.15.2/gitleaks_8.15.2_linux_x64.tar.gz + shell: pwsh + - name: Extract the tar file + run: tar xzvf gitleaks_8.15.2_linux_x64.tar.gz + - name: Generate the report + id: gitleaks + run: $GITHUB_WORKSPACE/gitleaks detect -s $GITHUB_WORKSPACE -f json -r $GITHUB_WORKSPACE/leaksreport.json + shell: bash + continue-on-error: true + - name: Setup NuGet.exe + if: steps.gitleaks.outcome != 'success' + uses: nuget/setup-nuget@v1 + with: + nuget-version: latest + - name: Install the dotnet + if: steps.gitleaks.outcome != 'success' + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '3.1.x' + - name: Install the report tool packages + if: steps.gitleaks.outcome != 'success' + run: | + nuget install "Syncfusion.Email" -source "https://nexus.syncfusion.com/repository/nuget-hosted/" + dir $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1 + dotnet $GITHUB_WORKSPACE/Syncfusion.Email.1.0.0/lib/netcoreapp3.1/Email.dll "citeam@syncfusion.com" "$GITHUB_REF_NAME" ${{ secrets.NETWORKCREDENTIALS }} ${{ secrets.NETWORKKEY }} "$GITHUB_WORKSPACE" + exit 1