Skip to content

Commit

Permalink
Merge pull request #1 from SyncfusionExamples/TASK-863857_Sample_for_…
Browse files Browse the repository at this point in the history
…Type1_Diabetes

Task-863857 Sample for type1 diabetes
  • Loading branch information
SyncfusionKarthikeyan authored Jan 11, 2024
2 parents 7223f4a + 6dd8e13 commit 0d09f0b
Show file tree
Hide file tree
Showing 39 changed files with 1,216 additions and 2 deletions.
31 changes: 31 additions & 0 deletions DiabetesDetails/DiabetesDetails.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiabetesDetails", "DiabetesDetails\DiabetesDetails.csproj", "{F6DEBD2B-55A2-4713-B42A-215870F13EC2}"
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
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release|Any CPU.Build.0 = Release|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release|Any CPU.Deploy.0 = Release|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release-Xml|Any CPU.ActiveCfg = Release|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release-Xml|Any CPU.Build.0 = Release|Any CPU
{F6DEBD2B-55A2-4713-B42A-215870F13EC2}.Release-Xml|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {39D66802-F3AD-41C9-AC9B-423405713762}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions DiabetesDetails/DiabetesDetails/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DiabetesDetails"
x:Class="DiabetesDetails.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions DiabetesDetails/DiabetesDetails/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace DiabetesDetails
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
14 changes: 14 additions & 0 deletions DiabetesDetails/DiabetesDetails/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="DiabetesDetails.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DiabetesDetails"
Shell.FlyoutBehavior="Disabled"
Title="DiabetesDetails">

<ShellContent
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
10 changes: 10 additions & 0 deletions DiabetesDetails/DiabetesDetails/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace DiabetesDetails
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
66 changes: 66 additions & 0 deletions DiabetesDetails/DiabetesDetails/DiabetesDetails.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>DiabetesDetails</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<ApplicationTitle>DiabetesDetails</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.diabetesdetails</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Syncfusion.Maui.Charts" Version="*" />
</ItemGroup>

</Project>
101 changes: 101 additions & 0 deletions DiabetesDetails/DiabetesDetails/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
xmlns:model="clr-namespace:DiabetesDetails"
x:Class="DiabetesDetails.MainPage">

<ContentPage.BindingContext>
<model:DiabetesData/>
</ContentPage.BindingContext>

<ContentPage.Resources>
<x:String x:Key="PathData1">M13.9502 4.09145C12.2933 4.0928 10.9513 5.43705 10.9526 7.0939L10.9731 32.0939C10.9745 33.7507 12.3187 35.0928 13.9756 35.0914L18.7256 35.0875C19.4159 35.087 19.9751 34.5269 19.9745 33.8365C19.974 33.1462 20.5332 32.5861 21.2235 32.5855L28.7235 32.5794C29.4139 32.5788 29.974 33.138 29.9745 33.8283C29.9751 34.5187 30.5352 35.0779 31.2256 35.0773L35.9756 35.0734C37.6324 35.0721 38.9745 33.7278 38.9731 32.071L38.9526 7.07097C38.9513 5.41412 37.607 4.07207 35.9502 4.07343L13.9502 4.09145ZM33.9534 8.07504L15.9534 8.08978L15.9682 26.0898L33.9682 26.075L33.9534 8.07504ZM16.9712 29.589C16.9707 29.0367 17.4181 28.5886 17.9704 28.5881L21.9702 28.5849C22.5225 28.5844 22.9706 29.0318 22.971 29.584C22.9715 30.1363 22.5242 30.5844 21.9719 30.5849L17.972 30.5881C17.4197 30.5886 16.9716 30.1412 16.9712 29.589ZM27.9704 28.5799C27.4181 28.5804 26.9707 29.0285 26.9712 29.5808C26.9716 30.133 27.4197 30.5804 27.972 30.5799L31.9719 30.5767C32.5242 30.5762 32.9715 30.1281 32.971 29.5758C32.9706 29.0236 32.5225 28.5762 31.9702 28.5767L27.9704 28.5799Z</x:String>
<x:String x:Key="PathData2">M28.9619 18.3342C28.9637 20.4676 27.205 22.1452 24.965 22.147C22.725 22.1489 20.9637 20.4741 20.9619 18.3408C20.9602 16.2075 24.9563 11.4804 24.9563 11.4804C24.9563 11.4804 28.9603 16.3533 28.9619 18.3342Z</x:String>
<x:String x:Key="PathData3">M28.974 33.0792L20.974 33.0857L20.9814 42.0857L28.9814 42.0791L28.974 33.0792ZM18.9724 31.0873L18.9831 44.0873L30.9831 44.0775L30.9724 31.0775L18.9724 31.0873Z</x:String>
<x:String x:Key="PathData4">M26.9782 38.0808C26.9791 39.1854 26.0844 40.0815 24.9798 40.0824C23.8753 40.0833 22.9791 39.1886 22.9782 38.0841C22.9773 36.9795 23.872 36.0833 24.9766 36.0824C26.0811 36.0815 26.9773 36.9762 26.9782 38.0808Z</x:String>
</ContentPage.Resources>

<Border BackgroundColor="#d6f6ff" Stroke="#0e385d" Padding="5" StrokeShape="RoundRectangle 10" Margin="30">

<chart:SfCartesianChart IsTransposed="True">

<chart:SfCartesianChart.Title>
<Label Text="Who Has Type 1 Diabetes?" FontSize="25" FontAttributes="Bold" FontFamily="Verdana"
HorizontalTextAlignment="Center" TextColor="#666666"/>
</chart:SfCartesianChart.Title>

<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowMajorGridLines="False">
<chart:CategoryAxis.AxisLineStyle>
<chart:ChartLineStyle StrokeWidth="0"/>
</chart:CategoryAxis.AxisLineStyle>
<chart:CategoryAxis.MajorTickStyle>
<chart:ChartAxisTickStyle StrokeWidth="0"/>
</chart:CategoryAxis.MajorTickStyle>
</chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>

<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis IsVisible="False" ShowMajorGridLines="False"/>
</chart:SfCartesianChart.YAxes>

<chart:ColumnSeries ItemsSource="{Binding Data}" XBindingPath="Country"
YBindingPath="Value" Fill="#008FFB" ShowDataLabels="True">

<chart:ColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings>
<chart:CartesianDataLabelSettings.LabelStyle>
<chart:ChartDataLabelStyle FontSize="{OnPlatform Android=10.5 , Default=13}"/>
</chart:CartesianDataLabelSettings.LabelStyle>
</chart:CartesianDataLabelSettings>
</chart:ColumnSeries.DataLabelSettings>

</chart:ColumnSeries>

<chart:SfCartesianChart.PlotAreaBackgroundView>
<AbsoluteLayout>
<Border AbsoluteLayout.LayoutBounds="{OnPlatform WinUI='0.9,0.3,-1,-1',Android='1,0.1,300,200', iOS='1,0.1,320,200', MacCatalyst='0.9,0.3,350,-1'}"
AbsoluteLayout.LayoutFlags="PositionProportional"
Stroke="#0e385d" StrokeShape="RoundRectangle 10" Margin="10">

<chart:SfCircularChart>
<chart:SfCircularChart.Title>
<Label Text="Age distribution in the US" FontSize="16" FontFamily="Verdana"
HorizontalTextAlignment="Center" Padding="0,5,0,0" TextColor="#666666"/>
</chart:SfCircularChart.Title>

<chart:SfCircularChart.Legend>
<chart:ChartLegend Placement="Bottom"/>
</chart:SfCircularChart.Legend>

<chart:DoughnutSeries ItemsSource="{Binding USDetails}" XBindingPath="AgeCategory" YBindingPath="Count"
InnerRadius="{OnPlatform Default=0.5,Android=0.6,iOS=0.6}" Radius="{OnPlatform Default=0.8,Android=1,iOS=1}"
ShowDataLabels="True" PaletteBrushes="{Binding CustomBrushes}">

<chart:DoughnutSeries.DataLabelSettings>
<chart:CircularDataLabelSettings>
<chart:CircularDataLabelSettings.LabelStyle>
<chart:ChartDataLabelStyle LabelFormat="0'%" FontSize="{OnPlatform Android=9,iOS=9}" Margin="0.1"/>
</chart:CircularDataLabelSettings.LabelStyle>
</chart:CircularDataLabelSettings>
</chart:DoughnutSeries.DataLabelSettings>

<chart:DoughnutSeries.CenterView>
<Grid Margin="-10,0,0,0">
<Path Data="{StaticResource PathData1}" Fill="#0d5e9b"/>
<Path Data="{StaticResource PathData2}" Fill="#E3465D"/>
<Path Data="{StaticResource PathData3}" Fill="#0d5e9b"/>
<Path Data="{StaticResource PathData4}" Fill="#0d5e9b"/>
</Grid>
</chart:DoughnutSeries.CenterView>
</chart:DoughnutSeries>
</chart:SfCircularChart>
</Border>
</AbsoluteLayout>
</chart:SfCartesianChart.PlotAreaBackgroundView>

</chart:SfCartesianChart>
</Border>

</ContentPage>
11 changes: 11 additions & 0 deletions DiabetesDetails/DiabetesDetails/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace DiabetesDetails
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
}

}
27 changes: 27 additions & 0 deletions DiabetesDetails/DiabetesDetails/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using Syncfusion.Maui.Core.Hosting;

namespace DiabetesDetails
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureSyncfusionCore()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif

return builder.Build();
}
}
}
29 changes: 29 additions & 0 deletions DiabetesDetails/DiabetesDetails/Model/DiabetesModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DiabetesDetails
{
public class DiabetesModel
{
public string Country { get; set; }
public double Value { get; set; }
public string AgeCategory { get; set; }
public double Count { get; set; }

public DiabetesModel(string country, double value)
{
Country = country;
Value = value;
}

//It is used to store the age-wise distribution of type 1 diabetes in the US
public DiabetesModel(double count, string ageCategory)
{
Count = count;
AgeCategory = ageCategory;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions DiabetesDetails/DiabetesDetails/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace DiabetesDetails
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.Landscape, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace DiabetesDetails
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace DiabetesDetails
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

Loading

0 comments on commit 0d09f0b

Please sign in to comment.