Skip to content

Commit ac2f5a3

Browse files
Resolved the chart SB sample issues.
1 parent 460485c commit ac2f5a3

File tree

19 files changed

+124
-92
lines changed

19 files changed

+124
-92
lines changed

maui/samples/Gallery/Samples/CartesianChart/BoxAndWhisker/BoxAndWhisker.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
HorizontalOptions="Fill" VerticalOptions="Start"
5858
SelectedIndex="0"
5959
SelectedIndexChanged="ModePicker_SelectedIndexChanged"
60-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
61-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
60+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
61+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}"
6262
></Picker>
6363
</HorizontalStackLayout>
6464
</VerticalStackLayout>

maui/samples/Gallery/Samples/CartesianChart/EmptyPoints/EmptyPointSupport.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@
102102
<Grid>
103103
<VerticalStackLayout Spacing="15">
104104
<HorizontalStackLayout Spacing="5">
105-
<Label Text="Empty Point Mode: " VerticalOptions="Start" HorizontalOptions="Center" Padding="5" FontSize="17"/>
105+
<Label Text="Empty Point Mode : " VerticalOptions="Start" HorizontalOptions="Center" Padding="5" FontSize="17"/>
106106
<Picker WidthRequest="{OnPlatform MacCatalyst=70, iOS=70}" ItemsSource="{Binding Source={x:Reference ViewModel},Path=EmptyPointModeValues}"
107107
SelectedItem="{Binding Source={x:Reference ViewModel}, Path=EmptyPointModeValues[0]}"
108-
VerticalOptions="Start" HorizontalOptions="Fill"
109-
x:Name="picker"
110-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
111-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
108+
VerticalOptions="Start" HorizontalOptions="Fill"
109+
x:Name="picker"
112110
SelectedIndex="0"
113-
SelectedIndexChanged="picker_SelectedIndexChanged">
111+
SelectedIndexChanged="picker_SelectedIndexChanged"
112+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
113+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}">
114114
</Picker>
115115
</HorizontalStackLayout>
116116
</VerticalStackLayout>

maui/samples/Gallery/Samples/CartesianChart/ErrorBar/ErrorBarChart.xaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@
8080
<ColumnDefinition Width="*"></ColumnDefinition>
8181
</Grid.ColumnDefinitions>
8282
<Label Grid.Row="0" Grid.Column="0" Text=" Type" HorizontalOptions="Start" Padding="5" FontSize="15"/>
83-
<Picker Grid.Row="0" Grid.Column="1"
83+
<Picker Grid.Row="0" Grid.Column="1" Margin="0,0,1,0"
8484
ItemsSource="{Binding Source={x:Reference ViewModel},Path=ErrorBarType}"
8585
SelectedItem="{Binding Source={x:Reference ViewModel}, Path=ErrorBarType[0]}"
8686
VerticalOptions="Start" HorizontalOptions="Fill"
8787
x:Name="typePicker"
88-
SelectedIndex="0"
89-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
90-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
91-
SelectedIndexChanged="typePicker_SelectedIndexChanged">
88+
SelectedIndex="0"
89+
SelectedIndexChanged="typePicker_SelectedIndexChanged"
90+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
91+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}">
9292
</Picker>
9393
</Grid>
9494
<Grid>
@@ -97,15 +97,15 @@
9797
<ColumnDefinition Width="*"></ColumnDefinition>
9898
</Grid.ColumnDefinitions>
9999
<Label Grid.Row="0" Grid.Column="0" Text="Mode" HorizontalOptions="Start" Padding="5" FontSize="15"/>
100-
<Picker Grid.Row="0" Grid.Column="1"
100+
<Picker Grid.Row="0" Grid.Column="1" Margin="0,0,1,0"
101101
ItemsSource="{Binding Source={x:Reference ViewModel},Path=ErrorBarMode}"
102102
SelectedItem="{Binding Source={x:Reference ViewModel}, Path=ErrorBarMode[0]}"
103103
VerticalOptions="Start" HorizontalOptions="Fill"
104104
x:Name="modePicker"
105-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
106-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
107105
SelectedIndex="0"
108-
SelectedIndexChanged="modePicker_SelectedIndexChanged">
106+
SelectedIndexChanged="modePicker_SelectedIndexChanged"
107+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
108+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}">
109109
</Picker>
110110
</Grid>
111111
<Grid>
@@ -114,15 +114,15 @@
114114
<ColumnDefinition Width="*"></ColumnDefinition>
115115
</Grid.ColumnDefinitions>
116116
<Label Grid.Row="0" Grid.Column="0" Text="Direction" HorizontalOptions="Start" Padding="5" FontSize="15"/>
117-
<Picker Grid.Row="0" Grid.Column="1"
117+
<Picker Grid.Row="0" Grid.Column="1" Margin="0,0,1,0"
118118
ItemsSource="{Binding Source={x:Reference ViewModel},Path=ErrorBarDirection}"
119119
SelectedItem="{Binding Source={x:Reference ViewModel}, Path=ErrorBarDirection[0]}"
120120
VerticalOptions="Start" HorizontalOptions="Fill"
121121
x:Name="directionPicker"
122-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
123-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
124122
SelectedIndex="0"
125-
SelectedIndexChanged="directionPicker_SelectedIndexChanged">
123+
SelectedIndexChanged="directionPicker_SelectedIndexChanged"
124+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
125+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}">
126126
</Picker>
127127
</Grid>
128128
<Grid>

maui/samples/Gallery/Samples/CartesianChart/PlotBand/HorizontalPlotBand.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@
7272
<VerticalStackLayout Spacing="5">
7373
<HorizontalStackLayout>
7474
<Label Text="Plot band types :" HorizontalOptions="Center" VerticalOptions="Start" Padding="5" FontSize="17"/>
75-
<Picker ItemsSource="{Binding Source={x:Reference ViewModel},Path=PlotBandType}" SelectedItem="{Binding Source={x:Reference ViewModel},Path=PlotBandType[0]}" BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
76-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}" HorizontalOptions="Fill" VerticalOptions="Start" SelectedIndex="0" SelectedIndexChanged="Picker_SelectedIndexChanged" WidthRequest="{OnPlatform iOS=80}"/>
75+
<Picker ItemsSource="{Binding Source={x:Reference ViewModel},Path=PlotBandType}" SelectedItem="{Binding Source={x:Reference ViewModel},Path=PlotBandType[0]}"
76+
HorizontalOptions="Fill" VerticalOptions="Start" SelectedIndex="0" SelectedIndexChanged="Picker_SelectedIndexChanged" WidthRequest="{OnPlatform iOS=80}"
77+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
78+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}"/>
7779
</HorizontalStackLayout>
7880
</VerticalStackLayout>
7981
</Grid>

maui/samples/Gallery/Samples/CartesianChart/PlotBand/HorizontalPlotBandWindows.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@
7171
<VerticalStackLayout Spacing="5">
7272
<HorizontalStackLayout>
7373
<Label Text="Plot band types :" HorizontalOptions="Center" VerticalOptions="Start" Padding="5" FontSize="17"/>
74-
<Picker ItemsSource="{Binding Source={x:Reference ViewModel},Path=PlotBandType}" SelectedItem="{Binding Source={x:Reference ViewModel},Path=PlotBandType[0]}" WidthRequest="{OnPlatform MacCatalyst=80}" BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
75-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}" HorizontalOptions="Fill" VerticalOptions="Start" SelectedIndex="0" SelectedIndexChanged="Picker_SelectedIndexChanged"/>
74+
<Picker ItemsSource="{Binding Source={x:Reference ViewModel},Path=PlotBandType}" SelectedItem="{Binding Source={x:Reference ViewModel},Path=PlotBandType[0]}" WidthRequest="{OnPlatform MacCatalyst=80}"
75+
HorizontalOptions="Fill" VerticalOptions="Start" SelectedIndex="0" SelectedIndexChanged="Picker_SelectedIndexChanged" Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
76+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}"/>
7677
</HorizontalStackLayout>
7778
</VerticalStackLayout>
7879
</Grid>

maui/samples/Gallery/Samples/CartesianChart/Selection/Selection.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
</chart:SfCartesianChart>
7676
<AbsoluteLayout VerticalOptions="Start" Margin="0,40,0,0" HeightRequest="40">
7777
<HorizontalStackLayout AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="1,0">
78-
<Label Text="Multiple Selection :" VerticalOptions="Center" FontSize="16" TextColor="{AppThemeBinding Default={StaticResource ContentForeground}}"/>
78+
<Label Text="Multiple Selection : " VerticalOptions="Center" FontSize="16" TextColor="{AppThemeBinding Default={StaticResource ContentForeground}}"/>
7979
<CheckBox x:Name="checkbox" HeightRequest="35" VerticalOptions="Center" CheckedChanged="checkbox_CheckedChanged"/>
8080
</HorizontalStackLayout>
8181
</AbsoluteLayout>

maui/samples/Gallery/Samples/CartesianChart/Selection/SeriesSelection.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
<AbsoluteLayout VerticalOptions="Start" Margin="0,40,0,0" HeightRequest="40">
7979
<HorizontalStackLayout AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="1,0">
80-
<Label Text="Multiple Selection :" VerticalOptions="Center" FontSize="16" TextColor="{AppThemeBinding Default={StaticResource ContentForeground}}"/>
80+
<Label Text="Multiple Selection : " VerticalOptions="Center" FontSize="16" TextColor="{AppThemeBinding Default={StaticResource ContentForeground}}"/>
8181
<CheckBox x:Name="checkbox" HeightRequest="35" VerticalOptions="Center" CheckedChanged="checkbox_CheckedChanged"/>
8282
</HorizontalStackLayout>
8383
</AbsoluteLayout>

maui/samples/Gallery/Samples/CartesianChart/Tooltip/CartesianTooltip.xaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,26 @@
2727
</chart:SfCartesianChart.Legend>
2828
<chart:SfCartesianChart.Resources>
2929
<ResourceDictionary>
30+
<local:TooltipValuesConverter x:Key="ValueConverter"/>
3031
<DataTemplate x:Key="template1">
3132
<StackLayout>
3233
<Label Text="Germany" HorizontalTextAlignment="Center" HorizontalOptions="Center" VerticalTextAlignment="Center" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontAttributes="Bold" FontFamily="Helvetica" Margin="0,2,0,2" FontSize="12" Grid.Row="0"/>
3334
<BoxView Color="{AppThemeBinding Default={StaticResource ContentBackground}}" HeightRequest="1" WidthRequest="100" />
34-
<StackLayout Orientation="Horizontal" VerticalOptions="Fill" Spacing="0" Padding="3" Margin="0">
35+
<StackLayout x:DataType="chart:TooltipInfo" Orientation="Horizontal" VerticalOptions="Fill" Spacing="0" Padding="3" Margin="0">
3536
<Ellipse TranslationY="-1" Stroke="{AppThemeBinding Default={StaticResource ContentBackground}}" StrokeThickness="2" HeightRequest="10" WidthRequest="10" Fill="{AppThemeBinding Light={StaticResource series1Light}, Dark={StaticResource series1Dark}}" Margin="0,3,3,0" />
36-
<Label Text="{Binding Item.Value1}" VerticalTextAlignment="Center" HorizontalOptions="Start" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" FontSize="12" Margin="3,0,3,0" />
37-
<Label Text="{Binding Item.Value,StringFormat=' : {0}M'}" VerticalTextAlignment="Center" HorizontalOptions="End" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" Margin="0,0,3,0" FontSize="12" />
37+
<Label Text="{Binding Item,Converter={StaticResource ValueConverter},ConverterParameter='Value1'}" VerticalTextAlignment="Center" HorizontalOptions="Start" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" FontSize="12" Margin="3,0,3,0" />
38+
<Label Text="{Binding Item,Converter={StaticResource ValueConverter},ConverterParameter='Value'}" VerticalTextAlignment="Center" HorizontalOptions="End" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" Margin="0,0,3,0" FontSize="12" />
3839
</StackLayout>
3940
</StackLayout>
4041
</DataTemplate>
4142
<DataTemplate x:Key="template2">
4243
<StackLayout>
4344
<Label Text="Mexico" HorizontalTextAlignment="Center" HorizontalOptions="Center" VerticalTextAlignment="Center" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontAttributes="Bold" FontFamily="Helvetica" Margin="0,2,0,2" FontSize="12" Grid.Row="0"/>
4445
<BoxView Color="{AppThemeBinding Default={StaticResource ContentBackground}}" HeightRequest="1" WidthRequest="100" />
45-
<StackLayout Orientation="Horizontal" VerticalOptions="Fill" Spacing="0" Padding="3" Margin="0">
46+
<StackLayout x:DataType="chart:TooltipInfo" Orientation="Horizontal" VerticalOptions="Fill" Spacing="0" Padding="3" Margin="0">
4647
<Ellipse TranslationY="-1" Stroke="{AppThemeBinding Default={StaticResource ContentBackground}}" StrokeThickness="2" HeightRequest="10" WidthRequest="10" Fill="{AppThemeBinding Light={StaticResource series2Light}, Dark={StaticResource series2Dark}}" Margin="0,3,3,0" />
47-
<Label Text="{Binding Item.Value1}" VerticalTextAlignment="Center" HorizontalOptions="Start" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" FontSize="12" Margin="3,0,3,0" />
48-
<Label Text="{Binding Item.Size,StringFormat=' : {0}M'}" VerticalTextAlignment="Center" HorizontalOptions="End" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" Margin="0,0,3,0" FontSize="12" />
48+
<Label Text="{Binding Item,Converter={StaticResource ValueConverter},ConverterParameter='Value1'}" VerticalTextAlignment="Center" HorizontalOptions="Start" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" FontSize="12" Margin="3,0,3,0" />
49+
<Label Text="{Binding Item,Converter={StaticResource ValueConverter},ConverterParameter='Size'}" VerticalTextAlignment="Center" HorizontalOptions="End" TextColor="{AppThemeBinding Default={StaticResource ContentBackground}}" FontFamily="Helvetica" Margin="0,0,3,0" FontSize="12" />
4950
</StackLayout>
5051
</StackLayout>
5152
</DataTemplate>

maui/samples/Gallery/Samples/CartesianChart/Tooltip/TooltipViewModel.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.ObjectModel;
2+
using System.Globalization;
23

34
namespace Syncfusion.Maui.ControlsGallery.CartesianChart.SfCartesianChart
45
{
@@ -22,4 +23,32 @@ public TooltipViewModel()
2223
];
2324
}
2425
}
26+
27+
public class TooltipValuesConverter : IValueConverter
28+
{
29+
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
30+
{
31+
if (value is ChartDataModel model)
32+
{
33+
var param = parameter?.ToString();
34+
35+
switch (param)
36+
{
37+
case "Value":
38+
return $": {model.Value}M";
39+
case "Size":
40+
return $": {model.Size}M";
41+
case "Value1":
42+
return model.Value1;
43+
}
44+
}
45+
46+
return value;
47+
}
48+
49+
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
50+
{
51+
return value;
52+
}
53+
}
2554
}

maui/samples/Gallery/Samples/CartesianChart/Trackball/CartesianTrackball.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@
115115
<Label Text="Mode: " VerticalOptions="Start" HorizontalOptions="Center" Padding="5" FontSize="17"/>
116116
<Picker ItemsSource="{Binding Source={x:Reference ViewModel},Path=DisplayMode}"
117117
SelectedItem="{Binding Source={x:Reference ViewModel}, Path=DisplayMode[0]}"
118-
VerticalOptions="Start" HorizontalOptions="Fill"
118+
VerticalOptions="Start" HorizontalOptions="Fill"
119119
x:Name="picker"
120-
BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}"
121-
TextColor="{AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}"
122120
SelectedIndex="0"
123-
SelectedIndexChanged="picker_SelectedIndexChanged">
121+
SelectedIndexChanged="picker_SelectedIndexChanged"
122+
Background="{OnPlatform Default={AppThemeBinding Dark={StaticResource TextColour1Dark}, Light={StaticResource BackgroundLight}},Android=Transparent}"
123+
TextColor="{OnPlatform Default={StaticResource TextColourLight}, Android={AppThemeBinding Light={StaticResource TextColourLight}, Dark={StaticResource TextColourDark}}}">
124124
</Picker>
125125
</HorizontalStackLayout>
126126
<HorizontalStackLayout Spacing="5">

0 commit comments

Comments
 (0)