Skip to content

Commit 7a680c9

Browse files
Added new sample
1 parent 0275329 commit 7a680c9

36 files changed

Lines changed: 1104 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Solution>
2+
<Project Path="CartesianChartSample/CartesianChartSample.csproj" />
3+
</Solution>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:CartesianChartSample"
5+
x:Class="CartesianChartSample.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
3+
namespace CartesianChartSample
4+
{
5+
public partial class App : Application
6+
{
7+
public App()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
protected override Window CreateWindow(IActivationState? activationState)
13+
{
14+
return new Window(new AppShell());
15+
}
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="CartesianChartSample.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:CartesianChartSample"
7+
Title="CartesianChartSample">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace CartesianChartSample
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net10.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
6+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
7+
8+
<!-- Note for MacCatalyst:
9+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
10+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
11+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
12+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
13+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
14+
15+
<OutputType>Exe</OutputType>
16+
<RootNamespace>CartesianChartSample</RootNamespace>
17+
<UseMaui>true</UseMaui>
18+
<SingleProject>true</SingleProject>
19+
<ImplicitUsings>enable</ImplicitUsings>
20+
<Nullable>enable</Nullable>
21+
22+
<!-- Enable XAML source generation for faster build times and improved performance.
23+
This generates C# code from XAML at compile time instead of runtime inflation.
24+
To disable, remove this line.
25+
For individual files, you can override by setting Inflator metadata:
26+
<MauiXaml Update="MyPage.xaml" Inflator="Default" /> (reverts to defaults: Runtime for Debug, XamlC for Release)
27+
<MauiXaml Update="MyPage.xaml" Inflator="Runtime" /> (force runtime inflation) -->
28+
<MauiXamlInflator>SourceGen</MauiXamlInflator>
29+
30+
<!-- Display name -->
31+
<ApplicationTitle>CartesianChartSample</ApplicationTitle>
32+
33+
<!-- App Identifier -->
34+
<ApplicationId>com.companyname.cartesianchartsample</ApplicationId>
35+
36+
<!-- Versions -->
37+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
38+
<ApplicationVersion>1</ApplicationVersion>
39+
40+
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
41+
<WindowsPackageType>None</WindowsPackageType>
42+
43+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">15.0</SupportedOSPlatformVersion>
44+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
45+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
46+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
47+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
48+
</PropertyGroup>
49+
50+
<ItemGroup>
51+
<!-- App Icon -->
52+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
53+
54+
<!-- Splash Screen -->
55+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
56+
57+
<!-- Images -->
58+
<MauiImage Include="Resources\Images\*" />
59+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
60+
61+
<!-- Custom Fonts -->
62+
<MauiFont Include="Resources\Fonts\*" />
63+
64+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
65+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
66+
</ItemGroup>
67+
68+
<ItemGroup>
69+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
70+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
71+
</ItemGroup>
72+
73+
<ItemGroup>
74+
<PackageReference Include="Syncfusion.Maui.Charts" Version="*" />
75+
<PackageReference Include="Syncfusion.Maui.Core" Version="*" />
76+
</ItemGroup>
77+
78+
</Project>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
5+
xmlns:model="clr-namespace:CartesianChartSample"
6+
x:Class="CartesianChartSample.MainPage">
7+
8+
9+
10+
<ContentPage.BindingContext>
11+
<model:PersonViewModel/>
12+
</ContentPage.BindingContext>
13+
14+
<ContentPage.Content>
15+
<Grid>
16+
<chart:SfCartesianChart>
17+
<chart:SfCartesianChart.Title>
18+
<Label Text="Height Comparison" HorizontalOptions="Center" />
19+
</chart:SfCartesianChart.Title>
20+
21+
<chart:SfCartesianChart.Legend>
22+
<chart:ChartLegend />
23+
</chart:SfCartesianChart.Legend>
24+
25+
<chart:SfCartesianChart.XAxes>
26+
<chart:CategoryAxis>
27+
<chart:CategoryAxis.Title>
28+
<chart:ChartAxisTitle Text="Name" />
29+
</chart:CategoryAxis.Title>
30+
</chart:CategoryAxis>
31+
</chart:SfCartesianChart.XAxes>
32+
33+
<chart:SfCartesianChart.YAxes>
34+
<chart:NumericalAxis>
35+
<chart:NumericalAxis.Title>
36+
<chart:ChartAxisTitle Text="Height(in cm)" />
37+
</chart:NumericalAxis.Title>
38+
</chart:NumericalAxis>
39+
</chart:SfCartesianChart.YAxes>
40+
41+
<!--Initialize the series for chart-->
42+
<chart:ColumnSeries Label="Height"
43+
EnableTooltip="True"
44+
ShowDataLabels="True"
45+
ItemsSource="{Binding Data}"
46+
XBindingPath="Name"
47+
YBindingPath="Height">
48+
<chart:ColumnSeries.DataLabelSettings>
49+
<chart:CartesianDataLabelSettings LabelPlacement="Inner" />
50+
</chart:ColumnSeries.DataLabelSettings>
51+
</chart:ColumnSeries>
52+
</chart:SfCartesianChart>
53+
</Grid>
54+
</ContentPage.Content>
55+
56+
</ContentPage>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace CartesianChartSample;
2+
3+
public partial class MainPage : ContentPage
4+
{
5+
public MainPage()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Extensions.Logging;
2+
using Syncfusion.Maui.Core.Hosting;
3+
4+
namespace CartesianChartSample
5+
{
6+
public static class MauiProgram
7+
{
8+
public static MauiApp CreateMauiApp()
9+
{
10+
var builder = MauiApp.CreateBuilder();
11+
builder
12+
.UseMauiApp<App>()
13+
.ConfigureSyncfusionCore()
14+
.ConfigureFonts(fonts =>
15+
{
16+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
17+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
18+
});
19+
20+
#if DEBUG
21+
builder.Logging.AddDebug();
22+
#endif
23+
24+
return builder.Build();
25+
}
26+
}
27+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
</manifest>

0 commit comments

Comments
 (0)