Skip to content

Commit 73f2fc4

Browse files
committed
updated sample to toolkit
1 parent c3e28a5 commit 73f2fc4

File tree

6 files changed

+43
-53
lines changed

6 files changed

+43
-53
lines changed

DataLabelTemplate/DataLabelTemplate.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
6161
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
6262
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
63-
<PackageReference Include="Syncfusion.Maui.Charts" Version="*" />
63+
<PackageReference Include="Syncfusion.Maui.Toolkit" Version="*" />
6464
</ItemGroup>
6565

6666
</Project>

DataLabelTemplate/MainPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="DataLabelTemplate.MainPage"
5-
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
5+
xmlns:chart="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit"
66
xmlns:local="clr-namespace:DataLabelTemplate">
77

88
<ContentPage.BindingContext>

DataLabelTemplate/MauiProgram.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Microsoft.Extensions.Logging;
2-
using Syncfusion.Maui.Core.Hosting;
2+
using Syncfusion.Maui.Toolkit.Hosting;
33

44
namespace DataLabelTemplate
55
{
@@ -9,8 +9,8 @@ public static MauiApp CreateMauiApp()
99
{
1010
var builder = MauiApp.CreateBuilder();
1111
builder
12-
.UseMauiApp<App>()
13-
.ConfigureSyncfusionCore()
12+
.UseMauiApp<App>()
13+
.ConfigureSyncfusionToolkit()
1414
.ConfigureFonts(fonts =>
1515
{
1616
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace DataLabelTemplate
8-
{
9-
public class Model
10-
{
11-
public string? Department { get; set; }
12-
13-
public double Value { get; set; }
14-
15-
public bool IsSummary { get; set; }
16-
}
17-
}
1+

2+
namespace DataLabelTemplate
3+
{
4+
public class Model
5+
{
6+
public string? Department { get; set; }
7+
8+
public double Value { get; set; }
9+
10+
public bool IsSummary { get; set; }
11+
}
12+
}
Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Collections.ObjectModel;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
7-
8-
namespace DataLabelTemplate
9-
{
10-
public class ChartViewModel
11-
{
12-
public ObservableCollection<Model> Data { get; set; }
13-
public ChartViewModel()
14-
{
15-
Data = new ObservableCollection<Model>();
16-
Data.Add(new Model() { Department = "Total", Value = 18000 });
17-
Data.Add(new Model() { Department = "Production", Value = -2000 });
18-
Data.Add(new Model() { Department = "Sales", Value = -5000 });
19-
Data.Add(new Model() { Department = "Investors contribution", Value = 3000 });
20-
Data.Add(new Model() { Department = "Logistics", Value = -1000 });
21-
Data.Add(new Model() { Department = "Shares profit", Value = 4000 });
22-
Data.Add(new Model() { Department = "Marketing", Value = -3000 });
23-
Data.Add(new Model() { Department = "Transport", Value = -1500 });
24-
Data.Add(new Model() { Department = "Balance", Value = 0, IsSummary = true });
25-
26-
}
27-
}
28-
}
1+
using System.Collections.ObjectModel;
2+
3+
namespace DataLabelTemplate
4+
{
5+
public class ChartViewModel
6+
{
7+
public ObservableCollection<Model> Data { get; set; }
8+
public ChartViewModel()
9+
{
10+
Data = new ObservableCollection<Model>();
11+
Data.Add(new Model() { Department = "Total", Value = 18000 });
12+
Data.Add(new Model() { Department = "Production", Value = -2000 });
13+
Data.Add(new Model() { Department = "Sales", Value = -5000 });
14+
Data.Add(new Model() { Department = "Investors contribution", Value = 3000 });
15+
Data.Add(new Model() { Department = "Logistics", Value = -1000 });
16+
Data.Add(new Model() { Department = "Shares profit", Value = 4000 });
17+
Data.Add(new Model() { Department = "Marketing", Value = -3000 });
18+
Data.Add(new Model() { Department = "Transport", Value = -1500 });
19+
Data.Add(new Model() { Department = "Balance", Value = 0, IsSummary = true });
20+
21+
}
22+
}
23+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# How to add a custom view to the data label of a .NET MAUI Chart
1+
# How to add a custom view to the data label of a .NET MAUI Toolkit
22

3-
This repository contains a sample project demonstrating how to add a custom view to the data label of a .NET MAUI Chart using Syncfusion controls.
3+
This repository contains a sample project demonstrating how to add a custom view to the data label of a .NET MAUI Toolkit using Syncfusion controls.
44

55
**Syncfusion Chart Control**
66

@@ -16,7 +16,7 @@ Utilize value converters to dynamically adjust the appearance of the label and i
1616

1717
**Integrating the Custom View with the Chart**
1818

19-
Assign the DataTemplate you created to the LabelTemplate property of the series within your chart. Ensure that the ShowDataLabels property is set to True to enable the display of data labels.
19+
Assign the DataTemplate you created to the [LabelTemplate](https://help.syncfusion.com/cr/maui-toolkit/Syncfusion.Maui.Toolkit.Charts.ChartSeries.html#Syncfusion_Maui_Toolkit_Charts_ChartSeries_LabelTemplate) property of the series within your chart. Ensure that the [ShowDataLabels](https://help.syncfusion.com/cr/maui-toolkit/Syncfusion.Maui.Toolkit.Charts.ChartSeries.html#Syncfusion_Maui_Toolkit_Charts_ChartSeries_ShowDataLabels) property is set to True to enable the display of data labels.
2020

2121
## Output
2222

0 commit comments

Comments
 (0)