Skip to content

Commit b584ab7

Browse files
saiyathalifathimabee.m@syncfusion.comsaiyathalifathimabee.m@syncfusion.com
authored andcommitted
Updated the sample
1 parent 89bf930 commit b584ab7

20 files changed

Lines changed: 353 additions & 313 deletions

ChartControlsThemeDemo/ChartControlsThemeDemo/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:local="clr-namespace:ChartControlsThemeDemo"
55
xmlns:syncTheme="clr-namespace:Syncfusion.Maui.Themes;assembly=Syncfusion.Maui.Core"
66
x:Class="ChartControlsThemeDemo.App">
7+
78
<Application.Resources>
89
<ResourceDictionary>
910
<ResourceDictionary.MergedDictionaries>

ChartControlsThemeDemo/ChartControlsThemeDemo/AppShell.xaml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,47 @@
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
66
xmlns:local="clr-namespace:ChartControlsThemeDemo"
7+
Shell.FlyoutWidth="200"
8+
Shell.FlyoutBackground="#8f80d4"
79
xmlns:switch="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.Buttons"
8-
Shell.FlyoutBehavior="Disabled"
10+
Shell.FlyoutBehavior="Locked"
911
Title="ChartControlsThemeDemo">
1012

11-
<ShellContent
12-
ContentTemplate="{DataTemplate local:MainPage}"
13-
Route="MainPage" />
13+
<Shell.FlyoutHeader>
14+
<Grid Padding="0,0,0,50" RowDefinitions="40,80" HorizontalOptions="Center">
15+
<Label Grid.Row="0" Text="Chart Types" VerticalOptions="End" HorizontalOptions="Center"
16+
FontSize="20" Margin="0,0,5,0" TextColor="White" FontAttributes="Bold"/>
17+
<Image Grid.Row="1" Source="chart.png" VerticalOptions="Center" HeightRequest="80"
18+
Margin="0,10,20,0" BackgroundColor="#8f80d4" HorizontalOptions="Center"/>
19+
</Grid>
20+
</Shell.FlyoutHeader>
1421

22+
<Shell.ItemTemplate>
23+
<DataTemplate>
24+
<Grid>
25+
<Label TextColor="White" FontSize="17" Margin="5,10,5,10"
26+
Text="{Binding Title}" VerticalTextAlignment="Center" />
27+
</Grid>
28+
</DataTemplate>
29+
</Shell.ItemTemplate>
30+
31+
<Shell.FlyoutFooter>
32+
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
33+
<Label Text="Change Theme" VerticalOptions="Center" FontSize="18"
34+
FontAttributes="Bold" TextColor="White"/>
35+
<switch:SfSwitch x:Name="switch" Margin="10,0,0,0" IsOn="False" StateChanged="switch_StateChanged"/>
36+
</StackLayout>
37+
</Shell.FlyoutFooter>
38+
39+
<ShellContent Title="Cartesian Chart" Route="page1" Shell.NavBarIsVisible="False"
40+
41+
ContentTemplate="{DataTemplate local:CartesianChartDemo}" />
42+
<ShellContent Title="Circular Chart" Route="page2" Shell.NavBarIsVisible="False"
43+
ContentTemplate="{DataTemplate local:CircularChartDemo}" />
44+
<ShellContent Title="Funnel Chart" Route="page3" Shell.NavBarIsVisible="False"
45+
ContentTemplate="{DataTemplate local:FunnelChartDemo}" />
46+
<ShellContent Title="Pyramid Chart" Route="page4" Shell.NavBarIsVisible="False"
47+
ContentTemplate="{DataTemplate local:PyramidChartDemo}" />
48+
<ShellContent Title="Sunburst Chart" Route="page5" Shell.NavBarIsVisible="False"
49+
ContentTemplate="{DataTemplate local:SunburstChartDemo}" />
1550
</Shell>
Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
1-
namespace ChartControlsThemeDemo
1+
using Syncfusion.Maui.Themes;
2+
namespace ChartControlsThemeDemo
23
{
34
public partial class AppShell : Shell
45
{
56
public AppShell()
67
{
78
InitializeComponent();
9+
10+
Routing.RegisterRoute("page1", typeof(CartesianChartDemo));
11+
Routing.RegisterRoute("page2", typeof(CircularChartDemo));
12+
Routing.RegisterRoute("page3", typeof(FunnelChartDemo));
13+
Routing.RegisterRoute("page4", typeof(PyramidChartDemo));
14+
Routing.RegisterRoute("page5", typeof(SunburstChartDemo));
15+
}
16+
17+
private void switch_StateChanged(object sender, Syncfusion.Maui.Buttons.SwitchStateChangedEventArgs e)
18+
{
19+
var state = e.NewValue;
20+
ICollection<ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
21+
if (mergedDictionaries != null)
22+
{
23+
var theme = mergedDictionaries.OfType<SyncfusionThemeResourceDictionary>().FirstOrDefault();
24+
if (theme != null)
25+
{
26+
if (state == false)
27+
{
28+
theme.VisualTheme = SfVisuals.MaterialLight;
29+
Application.Current.UserAppTheme = AppTheme.Light;
30+
}
31+
else
32+
{
33+
theme.VisualTheme = SfVisuals.MaterialDark;
34+
Application.Current.UserAppTheme = AppTheme.Dark;
35+
}
36+
}
37+
}
838
}
939
}
1040
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
3+
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
4+
xmlns:local="clr-namespace:ChartControlsThemeDemo"
5+
x:Class="ChartControlsThemeDemo.CartesianChartDemo">
6+
7+
<ContentPage.BindingContext>
8+
<local:ChartViewModel/>
9+
</ContentPage.BindingContext>
10+
11+
<chart:SfCartesianChart>
12+
13+
<chart:SfCartesianChart.Legend>
14+
<chart:ChartLegend ToggleSeriesVisibility="True"/>
15+
</chart:SfCartesianChart.Legend>
16+
17+
<chart:SfCartesianChart.Title>
18+
<Label Text="Inflation - Consumer Prices" Margin="0" HorizontalOptions="Fill" HorizontalTextAlignment="Center" VerticalOptions="Center" FontSize="16" />
19+
</chart:SfCartesianChart.Title>
20+
21+
<chart:SfCartesianChart.XAxes>
22+
<chart:CategoryAxis ShowMajorGridLines="false" Interval="2" PlotOffsetStart="10" PlotOffsetEnd="10" AxisLineOffset="10">
23+
<chart:CategoryAxis.MajorTickStyle>
24+
<chart:ChartAxisTickStyle TickSize="10">
25+
</chart:ChartAxisTickStyle>
26+
</chart:CategoryAxis.MajorTickStyle>
27+
</chart:CategoryAxis>
28+
29+
</chart:SfCartesianChart.XAxes>
30+
<chart:SfCartesianChart.YAxes>
31+
<chart:NumericalAxis Maximum="100" Minimum="0" Interval="20">
32+
<chart:NumericalAxis.LabelStyle>
33+
<chart:ChartAxisLabelStyle LabelFormat="0'%"/>
34+
</chart:NumericalAxis.LabelStyle>
35+
<chart:NumericalAxis.AxisLineStyle>
36+
<chart:ChartLineStyle StrokeWidth="0">
37+
</chart:ChartLineStyle>
38+
</chart:NumericalAxis.AxisLineStyle>
39+
<chart:NumericalAxis.MajorTickStyle>
40+
<chart:ChartAxisTickStyle TickSize="0" />
41+
</chart:NumericalAxis.MajorTickStyle>
42+
</chart:NumericalAxis>
43+
</chart:SfCartesianChart.YAxes>
44+
45+
<chart:LineSeries ItemsSource="{Binding LineData1}" XBindingPath="XValue" YBindingPath="YValue"
46+
Label="Germany" EnableTooltip="True" Fill="#314A6E"
47+
ShowMarkers="True" LegendIcon="SeriesType">
48+
</chart:LineSeries>
49+
50+
<chart:LineSeries ItemsSource="{Binding LineData2}" XBindingPath="XValue" YBindingPath="YValue"
51+
Label="England" EnableTooltip="True" Fill="#48988B"
52+
ShowMarkers="True" LegendIcon="SeriesType">
53+
</chart:LineSeries>
54+
55+
</chart:SfCartesianChart>
56+
57+
</ContentPage>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace ChartControlsThemeDemo
8+
{
9+
public partial class CartesianChartDemo : ContentPage
10+
{
11+
public CartesianChartDemo ()
12+
{
13+
InitializeComponent ();
14+
}
15+
}
16+
}

ChartControlsThemeDemo/ChartControlsThemeDemo/CartesianChart/SfCartesianChartThemeKeys.xaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
xmlns:sys="clr-namespace:System;assembly=mscorlib"
55
x:Class="ChartControlsThemeDemo.SfCartesianChartThemeKeys">
66

7-
87
<x:String x:Key="SfCartesianChartTheme">CommonTheme</x:String>
98

109
<Color x:Key="SfCartesianChartBackground"/>
@@ -62,5 +61,4 @@
6261
<sys:Double x:Key="SfCartesianChartLegendFontSize"/>
6362
<Color x:Key="SfCartesianChartLegendDisableBrush"/>
6463

65-
6664
</ResourceDictionary>

ChartControlsThemeDemo/ChartControlsThemeDemo/ChartControlsThemeDemo.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,37 @@
7373
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
7474
<PackageReference Include="Syncfusion.Maui.Buttons" Version="*" />
7575
<PackageReference Include="Syncfusion.Maui.Charts" Version="*" />
76-
<PackageReference Include="Syncfusion.Maui.NavigationDrawer" Version="26.1.39" />
7776
<PackageReference Include="Syncfusion.Maui.SunburstChart" Version="*" />
7877
</ItemGroup>
7978

8079
<ItemGroup>
8180
<MauiXaml Update="CartesianChart\SfCartesianChartThemeKeys.xaml">
8281
<Generator>MSBuild:Compile</Generator>
8382
</MauiXaml>
83+
<MauiXaml Update="CircularChart\CircularChartDemo.xaml">
84+
<Generator>MSBuild:Compile</Generator>
85+
</MauiXaml>
8486
<MauiXaml Update="CircularChart\SfCircularChartThemeKeys.xaml">
8587
<Generator>MSBuild:Compile</Generator>
8688
</MauiXaml>
89+
<MauiXaml Update="FunnelChart\FunnelChartDemo.xaml">
90+
<Generator>MSBuild:Compile</Generator>
91+
</MauiXaml>
8792
<MauiXaml Update="FunnelChart\SfFunnelChartThemeKeys.xaml">
8893
<Generator>MSBuild:Compile</Generator>
8994
</MauiXaml>
95+
<MauiXaml Update="PyramidChart\PyramidChartDemo.xaml">
96+
<Generator>MSBuild:Compile</Generator>
97+
</MauiXaml>
9098
<MauiXaml Update="PyramidChart\SfPyramidChartThemeKeys.xaml">
9199
<Generator>MSBuild:Compile</Generator>
92100
</MauiXaml>
93101
<MauiXaml Update="SunburstChart\SfSunburstChartThemeKeys.xaml">
94102
<Generator>MSBuild:Compile</Generator>
95103
</MauiXaml>
104+
<MauiXaml Update="SunburstChart\SunburstChartDemo.xaml">
105+
<Generator>MSBuild:Compile</Generator>
106+
</MauiXaml>
96107
</ItemGroup>
97108

98109
</Project>

ChartControlsThemeDemo/ChartControlsThemeDemo/ChartControlsThemeDemo.csproj.user

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,30 @@
99
<MauiXaml Update="CartesianChart\SfCartesianChartThemeKeys.xaml">
1010
<SubType>Designer</SubType>
1111
</MauiXaml>
12+
<MauiXaml Update="CircularChart\CircularChartDemo.xaml">
13+
<SubType>Designer</SubType>
14+
</MauiXaml>
1215
<MauiXaml Update="CircularChart\SfCircularChartThemeKeys.xaml">
1316
<SubType>Designer</SubType>
1417
</MauiXaml>
18+
<MauiXaml Update="FunnelChart\FunnelChartDemo.xaml">
19+
<SubType>Designer</SubType>
20+
</MauiXaml>
1521
<MauiXaml Update="FunnelChart\SfFunnelChartThemeKeys.xaml">
1622
<SubType>Designer</SubType>
1723
</MauiXaml>
24+
<MauiXaml Update="PyramidChart\PyramidChartDemo.xaml">
25+
<SubType>Designer</SubType>
26+
</MauiXaml>
1827
<MauiXaml Update="PyramidChart\SfPyramidChartThemeKeys.xaml">
1928
<SubType>Designer</SubType>
2029
</MauiXaml>
2130
<MauiXaml Update="SunburstChart\SfSunburstChartThemeKeys.xaml">
2231
<SubType>Designer</SubType>
2332
</MauiXaml>
33+
<MauiXaml Update="SunburstChart\SunburstChartDemo.xaml">
34+
<SubType>Designer</SubType>
35+
</MauiXaml>
2436
</ItemGroup>
2537
<ItemGroup>
2638
<None Update="App.xaml">
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
x:Class="ChartControlsThemeDemo.CircularChartDemo"
5+
xmlns:chart="clr-namespace:Syncfusion.Maui.Charts;assembly=Syncfusion.Maui.Charts"
6+
xmlns:local="clr-namespace:ChartControlsThemeDemo">
7+
8+
<ContentPage.BindingContext>
9+
<local:ChartViewModel/>
10+
</ContentPage.BindingContext>
11+
12+
<chart:SfCircularChart>
13+
14+
<chart:SfCircularChart.Title>
15+
<Label Text="Sales by a Salesperson" Margin="0,0,6,10" HorizontalOptions="Fill"
16+
HorizontalTextAlignment="Center" VerticalOptions="Center" FontSize="16"/>
17+
</chart:SfCircularChart.Title>
18+
19+
<chart:SfCircularChart.Legend>
20+
<chart:ChartLegend/>
21+
</chart:SfCircularChart.Legend>
22+
23+
<chart:SfCircularChart.Series>
24+
<chart:PieSeries ItemsSource="{Binding PieSeriesData}" XBindingPath="XValue" YBindingPath="YValue"
25+
ShowDataLabels="True" StrokeWidth="2" Stroke="White" EnableTooltip="True"
26+
LegendIcon="SeriesType" PaletteBrushes="{Binding PaletteBrushes}">
27+
28+
<chart:PieSeries.DataLabelSettings>
29+
<chart:CircularDataLabelSettings LabelPlacement="Outer">
30+
<chart:CircularDataLabelSettings.LabelStyle>
31+
<chart:ChartDataLabelStyle LabelFormat="#.##'%"/>
32+
</chart:CircularDataLabelSettings.LabelStyle>
33+
</chart:CircularDataLabelSettings>
34+
</chart:PieSeries.DataLabelSettings>
35+
</chart:PieSeries>
36+
</chart:SfCircularChart.Series>
37+
38+
</chart:SfCircularChart>
39+
40+
</ContentPage>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace ChartControlsThemeDemo;
2+
3+
public partial class CircularChartDemo : ContentPage
4+
{
5+
public CircularChartDemo()
6+
{
7+
InitializeComponent();
8+
}
9+
}

0 commit comments

Comments
 (0)