|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<ContentView |
| 3 | + x:Class="MAUIsland.Core.SfCartesianChartTooltip" |
| 4 | + xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
| 5 | + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
| 6 | + xmlns:core="clr-namespace:MAUIsland.Core" |
| 7 | + xmlns:toolkit="http://schemas.syncfusion.com/maui/toolkit" |
| 8 | + x:Name="root"> |
| 9 | + |
| 10 | + <VerticalStackLayout Spacing="5"> |
| 11 | + <Border StrokeShape="RoundRectangle 4" Margin="5" Padding="10"> |
| 12 | + <VerticalStackLayout Spacing="10"> |
| 13 | + <toolkit:SfCartesianChart HorizontalOptions="Fill" VerticalOptions="FillAndExpand" |
| 14 | + Margin="0, 0, 20, 0"> |
| 15 | + <toolkit:SfCartesianChart.Legend> |
| 16 | + <toolkit:ChartLegend ToggleSeriesVisibility="True" /> |
| 17 | + </toolkit:SfCartesianChart.Legend> |
| 18 | + <toolkit:SfCartesianChart.Title> |
| 19 | + <Label Text="Tooltip Column Sample Chart" Margin="0,0,0,5" HorizontalOptions="Fill" HorizontalTextAlignment="Center" VerticalOptions="Center" FontSize="16"/> |
| 20 | + </toolkit:SfCartesianChart.Title> |
| 21 | + <toolkit:SfCartesianChart.TooltipBehavior> |
| 22 | + <toolkit:ChartTooltipBehavior Duration="500" TextColor="Aqua" FontSize="16" Background="Gray"/> |
| 23 | + </toolkit:SfCartesianChart.TooltipBehavior> |
| 24 | + <toolkit:SfCartesianChart.XAxes> |
| 25 | + <toolkit:CategoryAxis ShowMajorGridLines="False" LabelPlacement="BetweenTicks"> |
| 26 | + </toolkit:CategoryAxis> |
| 27 | + </toolkit:SfCartesianChart.XAxes> |
| 28 | + <toolkit:SfCartesianChart.YAxes> |
| 29 | + <toolkit:NumericalAxis ShowMajorGridLines="True" Minimum="0"> |
| 30 | + </toolkit:NumericalAxis> |
| 31 | + </toolkit:SfCartesianChart.YAxes> |
| 32 | + <toolkit:SfCartesianChart.Series> |
| 33 | + <toolkit:ColumnSeries Label="Aqua" EnableTooltip="True" EnableAnimation="True" Width="0.8" Spacing="0.2" |
| 34 | + ItemsSource="{x:Binding ComponentData, Source={x:Reference root}}" |
| 35 | + XBindingPath="Name" YBindingPath="Exp" LegendIcon="SeriesType"/> |
| 36 | + <toolkit:ColumnSeries Label="Gray" EnableTooltip="True" EnableAnimation="True" Width="0.8" Spacing="0.2" |
| 37 | + ItemsSource="{x:Binding ComponentData, Source={x:Reference root}}" |
| 38 | + XBindingPath="Name" YBindingPath="Value" LegendIcon="SeriesType"/> |
| 39 | + </toolkit:SfCartesianChart.Series> |
| 40 | + </toolkit:SfCartesianChart> |
| 41 | + |
| 42 | + <core:SourceCodeExpander Code="{x:Binding TooltipCodeDescription, Source={x:Reference root}}" CodeType="Xaml"/> |
| 43 | + </VerticalStackLayout> |
| 44 | + </Border> |
| 45 | + |
| 46 | + <Label Text="The SfCartesianChart provides support to customize the appearance of the tooltip by using the TooltipTemplate property."/> |
| 47 | + <Border StrokeShape="RoundRectangle 4" Margin="5" Padding="10"> |
| 48 | + <Grid> |
| 49 | + <VerticalStackLayout> |
| 50 | + <HorizontalStackLayout Spacing="10"> |
| 51 | + <Image x:Name="ArrowImage" Grid.Column="1" HeightRequest="20" WidthRequest="20" |
| 52 | + Source="{x:StaticResource ArrowCircleRight24Regular}" /> |
| 53 | + <Label Text="Customization Tooltip" VerticalTextAlignment="Center" FontSize="16"/> |
| 54 | + </HorizontalStackLayout> |
| 55 | + <Border x:Name="Info" StrokeShape="RoundRectangle 4" Margin="10" Padding="10"> |
| 56 | + <VerticalStackLayout Spacing="5"> |
| 57 | + <toolkit:SfCartesianChart HorizontalOptions="Fill" VerticalOptions="FillAndExpand"> |
| 58 | + <toolkit:SfCartesianChart.Resources> |
| 59 | + <DataTemplate x:Key="TemplateColumn"> |
| 60 | + <VerticalStackLayout Spacing="5"> |
| 61 | + <HorizontalStackLayout VerticalOptions="Fill" HorizontalOptions="Center" Spacing="10"> |
| 62 | + <Ellipse TranslationY="-1" Stroke="Aqua" StrokeThickness="2" HeightRequest="10" WidthRequest="10" /> |
| 63 | + <Label Text="{x:Binding Item.Name}" HorizontalTextAlignment="Center" HorizontalOptions="Center" |
| 64 | + VerticalTextAlignment="Center" FontAttributes="Bold" |
| 65 | + FontFamily="Helvetica" Margin="0,2" FontSize="12"/> |
| 66 | + </HorizontalStackLayout> |
| 67 | + <BoxView HeightRequest="1" WidthRequest="100" Color="White" /> |
| 68 | + <HorizontalStackLayout VerticalOptions="Fill" > |
| 69 | + <Label Text="{x:Binding Item.Value, StringFormat='Value: {0}M'}" |
| 70 | + VerticalTextAlignment="Center" HorizontalOptions="Start" |
| 71 | + FontFamily="Helvetica" FontSize="12" /> |
| 72 | + <Label Text="{x:Binding Item.Exp, StringFormat=', Exp: {0}M'}" |
| 73 | + VerticalTextAlignment="Center" HorizontalOptions="End" |
| 74 | + FontFamily="Helvetica" FontSize="12" /> |
| 75 | + </HorizontalStackLayout> |
| 76 | + </VerticalStackLayout> |
| 77 | + </DataTemplate> |
| 78 | + </toolkit:SfCartesianChart.Resources> |
| 79 | + <toolkit:SfCartesianChart.Legend> |
| 80 | + <toolkit:ChartLegend ToggleSeriesVisibility="True" /> |
| 81 | + </toolkit:SfCartesianChart.Legend> |
| 82 | + <toolkit:SfCartesianChart.Title> |
| 83 | + <Label Text="Custom Tooltip Column Sample Chart" Margin="0,0,0,5" HorizontalOptions="Fill" HorizontalTextAlignment="Center" VerticalOptions="Center" FontSize="16"/> |
| 84 | + </toolkit:SfCartesianChart.Title> |
| 85 | + <toolkit:SfCartesianChart.XAxes> |
| 86 | + <toolkit:CategoryAxis ShowMajorGridLines="False" LabelPlacement="BetweenTicks"> |
| 87 | + </toolkit:CategoryAxis> |
| 88 | + </toolkit:SfCartesianChart.XAxes> |
| 89 | + <toolkit:SfCartesianChart.YAxes> |
| 90 | + <toolkit:NumericalAxis ShowMajorGridLines="True" Minimum="0"> |
| 91 | + </toolkit:NumericalAxis> |
| 92 | + </toolkit:SfCartesianChart.YAxes> |
| 93 | + <toolkit:SfCartesianChart.Series> |
| 94 | + <toolkit:ColumnSeries Label="Aqua" EnableAnimation="True" Width="0.8" Spacing="0.2" |
| 95 | + ItemsSource="{Binding ComponentData, Source={x:Reference root}}" |
| 96 | + XBindingPath="Name" YBindingPath="Exp" LegendIcon="SeriesType" |
| 97 | + EnableTooltip="True" TooltipTemplate="{x:StaticResource TemplateColumn}"/> |
| 98 | + <toolkit:ColumnSeries Label="Gray" EnableAnimation="True" Width="0.8" Spacing="0.2" |
| 99 | + ItemsSource="{Binding ComponentData, Source={x:Reference root}}" |
| 100 | + XBindingPath="Name" YBindingPath="Value" LegendIcon="SeriesType" |
| 101 | + EnableTooltip="True" TooltipTemplate="{x:StaticResource TemplateColumn}"/> |
| 102 | + </toolkit:SfCartesianChart.Series> |
| 103 | + </toolkit:SfCartesianChart> |
| 104 | + |
| 105 | + <core:SourceCodeExpander Code="{x:Binding CustomToolTipCodeDescription, Source={x:Reference root}}" CodeType="Xaml"/> |
| 106 | + </VerticalStackLayout> |
| 107 | + </Border> |
| 108 | + </VerticalStackLayout> |
| 109 | + <Grid.GestureRecognizers> |
| 110 | + <TapGestureRecognizer Tapped="OnGridTapped" /> |
| 111 | + </Grid.GestureRecognizers> |
| 112 | + </Grid> |
| 113 | + </Border> |
| 114 | + </VerticalStackLayout> |
| 115 | +</ContentView> |
0 commit comments