diff --git a/DisplayTrackballValues/DisplayTrackballValues.sln b/DisplayTrackballValues/DisplayTrackballValues.sln new file mode 100644 index 0000000..d2d723b --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35027.167 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DisplayTrackballValues", "DisplayTrackballValues\DisplayTrackballValues.csproj", "{CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Release|Any CPU.Build.0 = Release|Any CPU + {CBDBBD45-3C8E-42A5-A282-D1AFC1E0861D}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FE2B269-B05B-4E5A-BE28-C1D888F7C384} + EndGlobalSection +EndGlobal diff --git a/DisplayTrackballValues/DisplayTrackballValues/App.xaml b/DisplayTrackballValues/DisplayTrackballValues/App.xaml new file mode 100644 index 0000000..ba4928e --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/App.xaml.cs b/DisplayTrackballValues/DisplayTrackballValues/App.xaml.cs new file mode 100644 index 0000000..f87698d --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/App.xaml.cs @@ -0,0 +1,12 @@ +namespace DisplayTrackballValues +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml b/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml new file mode 100644 index 0000000..7c226d6 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml.cs b/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml.cs new file mode 100644 index 0000000..9201986 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/AppShell.xaml.cs @@ -0,0 +1,10 @@ +namespace DisplayTrackballValues +{ + public partial class AppShell : Shell + { + public AppShell() + { + InitializeComponent(); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/DisplayTrackballValues.csproj b/DisplayTrackballValues/DisplayTrackballValues/DisplayTrackballValues.csproj new file mode 100644 index 0000000..411f0e1 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/DisplayTrackballValues.csproj @@ -0,0 +1,66 @@ + + + + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 + + + + + + + Exe + DisplayTrackballValues + true + true + enable + enable + + + DisplayTrackballValues + + + com.companyname.displaytrackballvalues + + + 1.0 + 1 + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml b/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml new file mode 100644 index 0000000..74c3ff1 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml.cs b/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml.cs new file mode 100644 index 0000000..5b7791d --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/MainPage.xaml.cs @@ -0,0 +1,71 @@ +using Syncfusion.Maui.Charts; + +namespace DisplayTrackballValues +{ + public partial class MainPage : ContentPage + { + public MainPage() + { + InitializeComponent(); + } + + private void chart_TrackballCreated(object sender, TrackballEventArgs e) + { + var items = e.TrackballPointsInfo; + + foreach (var item in items) + { + var series = item.Series; + + if (series == series1) + { + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.DeepSkyBlue, + Width = 15, + Height = 15, + Stroke = Colors.RoyalBlue, + StrokeWidth = 3, + Type = ShapeType.InvertedTriangle + }; + + dateLabel1.SetBinding(Label.TextProperty, new Binding("Date") { Source = item.DataItem, StringFormat = "{0:dd/MM/yyyy}" }); + valueLabel1.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + + else if (series == series2) + { + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.LightPink, + Width = 15, + Height = 15, + Stroke = Colors.HotPink, + StrokeWidth = 3, + Type = ShapeType.Cross + }; + + dateLabel2.SetBinding(Label.TextProperty, new Binding("Date") { Source = item.DataItem, StringFormat = "{0:dd/MM/yyyy}" }); + valueLabel2.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + + else if (series == series3) + { + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.LightSeaGreen, + Width = 15, + Height = 15, + Stroke = Colors.Green, + StrokeWidth = 3, + Type = ShapeType.Diamond + }; + + dateLabel3.SetBinding(Label.TextProperty, new Binding("Date") { Source = item.DataItem, StringFormat = "{0:dd/MM/yyyy}" }); + valueLabel3.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + } + } + } + +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/MauiProgram.cs b/DisplayTrackballValues/DisplayTrackballValues/MauiProgram.cs new file mode 100644 index 0000000..1d6ce2a --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/MauiProgram.cs @@ -0,0 +1,27 @@ +using Microsoft.Extensions.Logging; +using Syncfusion.Maui.Core.Hosting; + +namespace DisplayTrackballValues +{ + public static class MauiProgram + { + public static MauiApp CreateMauiApp() + { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureSyncfusionCore() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); + +#if DEBUG + builder.Logging.AddDebug(); +#endif + + return builder.Build(); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Model/Model.cs b/DisplayTrackballValues/DisplayTrackballValues/Model/Model.cs new file mode 100644 index 0000000..a5cc65c --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Model/Model.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DisplayTrackballValues +{ + public class Model + { + public DateTime Date { get; set; } + public double ProductASales { get; set; } + public double ProductBSales { get; set; } + public double ProductCSales { get; set; } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/AndroidManifest.xml b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/AndroidManifest.xml new file mode 100644 index 0000000..e9937ad --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainActivity.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainActivity.cs new file mode 100644 index 0000000..15bde13 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainActivity.cs @@ -0,0 +1,11 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; + +namespace DisplayTrackballValues +{ + [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] + public class MainActivity : MauiAppCompatActivity + { + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainApplication.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainApplication.cs new file mode 100644 index 0000000..32a77cc --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/MainApplication.cs @@ -0,0 +1,16 @@ +using Android.App; +using Android.Runtime; + +namespace DisplayTrackballValues +{ + [Application] + public class MainApplication : MauiApplication + { + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/Resources/values/colors.xml b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 0000000..c04d749 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/AppDelegate.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 0000000..acb7845 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace DisplayTrackballValues +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Entitlements.plist b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 0000000..de4adc9 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Info.plist b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Info.plist new file mode 100644 index 0000000..7268977 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + UIDeviceFamily + + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Program.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Program.cs new file mode 100644 index 0000000..9277e64 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,16 @@ +using ObjCRuntime; +using UIKit; + +namespace DisplayTrackballValues +{ + public class Program + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/Main.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/Main.cs new file mode 100644 index 0000000..467f229 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/Main.cs @@ -0,0 +1,17 @@ +using Microsoft.Maui; +using Microsoft.Maui.Hosting; +using System; + +namespace DisplayTrackballValues +{ + internal class Program : MauiApplication + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/tizen-manifest.xml b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 0000000..e7e1b15 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + maui-appicon-placeholder + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml new file mode 100644 index 0000000..8ead957 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml.cs new file mode 100644 index 0000000..439ad9b --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/App.xaml.cs @@ -0,0 +1,25 @@ +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace DisplayTrackballValues.WinUI +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : MauiWinUIApplication + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } + +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/Package.appxmanifest b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/Package.appxmanifest new file mode 100644 index 0000000..db25333 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,46 @@ + + + + + + + + + $placeholder$ + User Name + $placeholder$.png + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/app.manifest b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/app.manifest new file mode 100644 index 0000000..2593810 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/AppDelegate.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/AppDelegate.cs new file mode 100644 index 0000000..acb7845 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,10 @@ +using Foundation; + +namespace DisplayTrackballValues +{ + [Register("AppDelegate")] + public class AppDelegate : MauiUIApplicationDelegate + { + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Info.plist b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Info.plist new file mode 100644 index 0000000..0004a4f --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Info.plist @@ -0,0 +1,32 @@ + + + + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Program.cs b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Program.cs new file mode 100644 index 0000000..9277e64 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Platforms/iOS/Program.cs @@ -0,0 +1,16 @@ +using ObjCRuntime; +using UIKit; + +namespace DisplayTrackballValues +{ + public class Program + { + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } + } +} diff --git a/DisplayTrackballValues/DisplayTrackballValues/Properties/launchSettings.json b/DisplayTrackballValues/DisplayTrackballValues/Properties/launchSettings.json new file mode 100644 index 0000000..edf8aad --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Windows Machine": { + "commandName": "MsixPackage", + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appicon.svg b/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appicon.svg new file mode 100644 index 0000000..9d63b65 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appiconfg.svg b/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appiconfg.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/AppIcon/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Regular.ttf b/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..9ab655d Binary files /dev/null and b/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Regular.ttf differ diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Semibold.ttf b/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 0000000..2b7468e Binary files /dev/null and b/DisplayTrackballValues/DisplayTrackballValues/Resources/Fonts/OpenSans-Semibold.ttf differ diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Images/dotnet_bot.png b/DisplayTrackballValues/DisplayTrackballValues/Resources/Images/dotnet_bot.png new file mode 100644 index 0000000..f93ce02 Binary files /dev/null and b/DisplayTrackballValues/DisplayTrackballValues/Resources/Images/dotnet_bot.png differ diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Raw/AboutAssets.txt b/DisplayTrackballValues/DisplayTrackballValues/Resources/Raw/AboutAssets.txt new file mode 100644 index 0000000..15d6244 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/Raw/AboutAssets.txt @@ -0,0 +1,15 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories). Deployment of the asset to your application +is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. + + + +These files will be deployed with you package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Splash/splash.svg b/DisplayTrackballValues/DisplayTrackballValues/Resources/Splash/splash.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/Splash/splash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Colors.xaml b/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Colors.xaml new file mode 100644 index 0000000..30307a5 --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Colors.xaml @@ -0,0 +1,45 @@ + + + + + + + #512BD4 + #ac99ea + #242424 + #DFD8F7 + #9880e5 + #2B0B98 + + White + Black + #D600AA + #190649 + #1f1f1f + + #E1E1E1 + #C8C8C8 + #ACACAC + #919191 + #6E6E6E + #404040 + #212121 + #141414 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Styles.xaml b/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Styles.xaml new file mode 100644 index 0000000..e0d36bb --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/Resources/Styles/Styles.xaml @@ -0,0 +1,426 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DisplayTrackballValues/DisplayTrackballValues/ViewModel/ViewModel.cs b/DisplayTrackballValues/DisplayTrackballValues/ViewModel/ViewModel.cs new file mode 100644 index 0000000..fc2c12a --- /dev/null +++ b/DisplayTrackballValues/DisplayTrackballValues/ViewModel/ViewModel.cs @@ -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 DisplayTrackballValues +{ + public class ViewModel + { + public ObservableCollection ProductSalesDetails { get; set; } + + public ViewModel() + { + ProductSalesDetails = new ObservableCollection(); + + ProductSalesDetails.Add(new Model() { ProductASales = 5, ProductBSales = 5, ProductCSales = 5, Date = new DateTime(2001, 01, 05) }); + ProductSalesDetails.Add(new Model() { ProductASales = 10, ProductBSales = 15, ProductCSales = 13, Date = new DateTime(2001, 03, 06) }); + ProductSalesDetails.Add(new Model() { ProductASales = 15, ProductBSales = 20, ProductCSales = 25, Date = new DateTime(2001, 05, 07) }); + ProductSalesDetails.Add(new Model() { ProductASales = 10, ProductBSales = 15, ProductCSales = 20, Date = new DateTime(2001, 07, 08) }); + ProductSalesDetails.Add(new Model() { ProductASales = 25, ProductBSales = 20, ProductCSales = 35, Date = new DateTime(2001, 09, 09) }); + ProductSalesDetails.Add(new Model() { ProductASales = 35, ProductBSales = 40, ProductCSales = 50, Date = new DateTime(2001, 11, 10) }); + + } + } +} diff --git a/README.md b/README.md index ef32b53..25dbee2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,250 @@ -# How-to-display-X-and-Y-values-of-trackball-moving-trace-in-Labels-in-.NET-MAUI-Cartesian-Chart -This article in the Syncfusion Knowledge Base explains how to display X and Y values of trackball moving trace in Labels in .NET MAUI Cartesian Chart +# How to display X and Y values of trackball moving trace in Labels in .NET MAUI Cartesian Chart + +The [.NET MAUI Cartesian Chart](https://www.syncfusion.com/maui-controls/maui-charts) allows you to display X and Y values of trackball moving trace in Labels. This can be achieved using the [TrackballCreated](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html#Syncfusion_Maui_Charts_SfCartesianChart_TrackballCreated) event provided by the [SfCartesianChart](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html). + +**Step 1 :** Initialize the SfCartesianChart with [Trackball Behavior](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartTrackballBehavior.html), Create the [TrackballCreated](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html#Syncfusion_Maui_Charts_SfCartesianChart_TrackballCreated) event, which is triggered when the trackball moves from one data point to another. Refer to the [documentation](https://help.syncfusion.com/maui/cartesian-charts/getting-started) for detailed steps on initializing the SfCartesianChart. + +**[XAML]** +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` +**Step 2 :** Add a `VerticalStackLayout` in `Grid` to display the X and Y values from the [Trackball Behavior](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartTrackballBehavior.html) interaction for each series. + +**[XAML]** +``` + + + + + + + + + . . . + + + + + + + +``` +**Step 3 :** Finally, handle the [TrackballCreated](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html#Syncfusion_Maui_Charts_SfCartesianChart_TrackballCreated) event to bind the corresponding date and value labels based on the trackball's position and customize marker settings for each series. + +**[C#]** +``` +private void chart_TrackballCreated(object sender, TrackballEventArgs e) +{ + // Retrieve the trackball points information + var items = e.TrackballPointsInfo; + + foreach (var item in items) + { + var series = item.Series; + + if (series == series1) + { + // Configure marker settings for the first series + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.DeepSkyBlue, + Width = 15, + Height = 15, + Stroke = Colors.RoyalBlue, + StrokeWidth = 3, + Type = ShapeType.InvertedTriangle + }; + + // Bind the date label to the date from the data item with a specific format + dateLabel1.SetBinding(Label.TextProperty, new Binding("Date") + { + Source = item.DataItem, + StringFormat = "{0:dd/MM/yyyy}" + }); + + // Bind the value to the label from the item + valueLabel1.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + + else if (series == series2) + { + // Configure marker settings for the second series + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.LightPink, + Width = 15, + Height = 15, + Stroke = Colors.HotPink, + StrokeWidth = 3, + Type = ShapeType.Cross + }; + + // Bind the date label to the date from the data item with a specific format + dateLabel2.SetBinding(Label.TextProperty, new Binding("Date") + { + Source = item.DataItem, + StringFormat = "{0:dd/MM/yyyy}" + }); + + // Bind the value to the label from the item + valueLabel2.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + + else if (series == series3) + { + // Configure marker settings for the third series + item.MarkerSettings = new ChartMarkerSettings() + { + Fill = Colors.LightSeaGreen, + Width = 15, + Height = 15, + Stroke = Colors.Green, + StrokeWidth = 3, + Type = ShapeType.Diamond + }; + + // Bind the date label to the date from the data item with a specific format + dateLabel3.SetBinding(Label.TextProperty, new Binding("Date") + { + Source = item.DataItem, + StringFormat = "{0:dd/MM/yyyy}" + }); + + // Bind the value to the label from the item + valueLabel3.SetBinding(Label.TextProperty, new Binding("Label") { Source = item }); + } + } +} +``` +This setup allows the [TrackballCreated](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html#Syncfusion_Maui_Charts_SfCartesianChart_TrackballCreated) method to manage and display the trackball values dynamically for each series with unique marker styles. + +**Output** + + ![DisplayTrackballValues.gif](https://support.syncfusion.com/kb/agent/attachment/article/17704/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMjQ3Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.hJ9fzo7VIXOBN4Buao5sPVWa52kPuCDSKgAwwBXPYVM) + +## Troubleshooting + +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 [Display trackball values in layout KB article](https://support.syncfusion.com/kb/article/17704/how-to-display-x-and-y-values-of-trackball-moving-trace-in-labels-in-net-maui-cartesian-chart). \ No newline at end of file