Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions DataLabelTemplate/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:DataLabelTemplate"
x:Class="DataLabelTemplate.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 DataLabelTemplate/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace DataLabelTemplate
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
14 changes: 14 additions & 0 deletions DataLabelTemplate/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="DataLabelTemplate.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DataLabelTemplate"
Shell.FlyoutBehavior="Disabled"
Title="DataLabelTemplate">

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

</Shell>
10 changes: 10 additions & 0 deletions DataLabelTemplate/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace DataLabelTemplate
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
72 changes: 72 additions & 0 deletions DataLabelTemplate/Convertor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataLabelTemplate
{
public class ValueToSummaryValueConverter : IValueConverter
{
private double sumOfValues = 0;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value == null || !(value is double))
return null;

double numericValue = (double)value;
sumOfValues += numericValue;
if (numericValue == 0)
return sumOfValues;
else
return numericValue;
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

public class ValueToColorConverter : IValueConverter
{

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null || !(value is double))
return Colors.Transparent;

double numericValue = (double)value;
if (numericValue == 0)
return Color.FromHex("#3333cc");
else
return numericValue > 0 ? Color.FromHex("#3bab46") : Color.FromHex("#df3320");
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}

public class ValueToImageConvertor : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value == null || !(value is double))
return null;

double numericValue = (double)value;
if (numericValue == 0)
return null;
else
return numericValue > 0 ? "up.png" : "down.png";
}

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
66 changes: 66 additions & 0 deletions DataLabelTemplate/DataLabelTemplate.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>DataLabelTemplate</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

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

<!-- App Identifier -->
<ApplicationId>com.companyname.datalabeltemplate</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.Toolkit" Version="*" />
</ItemGroup>

</Project>
31 changes: 31 additions & 0 deletions DataLabelTemplate/DataLabelTemplate.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<ActiveDebugFramework>net8.0-windows10.0.19041.0</ActiveDebugFramework>
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
</PropertyGroup>
<ItemGroup>
<None Update="App.xaml">
<SubType>Designer</SubType>
</None>
<None Update="AppShell.xaml">
<SubType>Designer</SubType>
</None>
<None Update="MainPage.xaml">
<SubType>Designer</SubType>
</None>
<None Update="Platforms\Windows\App.xaml">
<SubType>Designer</SubType>
</None>
<None Update="Platforms\Windows\Package.appxmanifest">
<SubType>Designer</SubType>
</None>
<None Update="Resources\Styles\Colors.xaml">
<SubType>Designer</SubType>
</None>
<None Update="Resources\Styles\Styles.xaml">
<SubType>Designer</SubType>
</None>
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions DataLabelTemplate/DataLabelTemplate.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34622.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataLabelTemplate", "DataLabelTemplate.csproj", "{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Release|Any CPU.Build.0 = Release|Any CPU
{13A2C44B-3AC6-45CE-9F0B-1D17070557D0}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9D8766D1-6381-4336-BAA0-023A3227E2B8}
EndGlobalSection
EndGlobal
61 changes: 61 additions & 0 deletions DataLabelTemplate/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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"
x:Class="DataLabelTemplate.MainPage"
xmlns:chart="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit"
xmlns:local="clr-namespace:DataLabelTemplate">

<ContentPage.BindingContext>
<local:ChartViewModel x:Name="ViewModel"></local:ChartViewModel>
</ContentPage.BindingContext>

<ContentPage.Resources>
<ResourceDictionary>
<local:ValueToSummaryValueConverter x:Key="ValueToValueConverter"/>
<local:ValueToColorConverter x:Key="ValueToColorConverter"/>
<local:ValueToImageConvertor x:Key="ValueToImageConverter"></local:ValueToImageConvertor>
<DataTemplate x:Key="dataLabel">
<StackLayout Orientation="Horizontal" Spacing="3">
<Label FontSize="14" FontAttributes="Bold">
<Label.Text>
<Binding Path="Item.Value" Converter="{StaticResource ValueToValueConverter}" StringFormat="{}$.{0}"/>
</Label.Text>
<Label.TextColor>
<Binding Path="Item.Value" Converter="{StaticResource ValueToColorConverter}"/>
</Label.TextColor>
</Label>
<Image Source="{Binding Item.Value,Converter={StaticResource ValueToImageConverter}}" HeightRequest="15" WidthRequest="15"></Image>
</StackLayout>
</DataTemplate>
</ResourceDictionary>
</ContentPage.Resources>


<chart:SfCartesianChart >
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis></chart:CategoryAxis>
</chart:SfCartesianChart.XAxes>

<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Minimum="0" Maximum="20000" Interval="4000"></chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>


<chart:WaterfallSeries ItemsSource="{Binding Data}"
XBindingPath="Department"
YBindingPath="Value"
Fill="#3bab46"
NegativePointsBrush="#df3320"
ShowDataLabels="True"
LabelTemplate="{StaticResource dataLabel}"
SummaryBindingPath="IsSummary"
SummaryPointsBrush="#3333cc">


<chart:WaterfallSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings LabelPlacement="Outer" UseSeriesPalette="False"></chart:CartesianDataLabelSettings>
</chart:WaterfallSeries.DataLabelSettings>
</chart:WaterfallSeries>
</chart:SfCartesianChart>

</ContentPage>
15 changes: 15 additions & 0 deletions DataLabelTemplate/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace DataLabelTemplate
{
public partial class MainPage : ContentPage
{


public MainPage()
{
InitializeComponent();
}


}

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

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

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

return builder.Build();
}
}
}
12 changes: 12 additions & 0 deletions DataLabelTemplate/Model/Model.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

namespace DataLabelTemplate
{
public class Model
{
public string? Department { get; set; }

public double Value { get; set; }

public bool IsSummary { get; set; }
}
}
6 changes: 6 additions & 0 deletions DataLabelTemplate/Platforms/Android/AndroidManifest.xml
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 DataLabelTemplate/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 DataLabelTemplate
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
Loading