|
| 1 | +<Window x:Class="WPFStackedArea100Chart.MainWindow" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 5 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 6 | + xmlns:local="clr-namespace:WPFStackedArea100Chart" |
| 7 | + xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF" |
| 8 | + mc:Ignorable="d" |
| 9 | + Title="MainWindow" Height="450" Width="800"> |
| 10 | + <Grid x:Name="grid"> |
| 11 | + <Grid.DataContext> |
| 12 | + <local:ViewModel/> |
| 13 | + </Grid.DataContext> |
| 14 | + <Grid.Resources> |
| 15 | + <DataTemplate x:Key="tooltipTemplate"> |
| 16 | + <StackPanel Orientation="Horizontal"> |
| 17 | + <TextBlock Text="{Binding Series.Label}" |
| 18 | + Foreground="White" FontWeight="Medium" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
| 19 | + <TextBlock Text=" : " Foreground="White" FontWeight="Medium" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
| 20 | + <TextBlock Text="{Binding YData,StringFormat='###'}" |
| 21 | + Foreground="White" FontWeight="Medium" FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
| 22 | + </StackPanel> |
| 23 | + </DataTemplate> |
| 24 | + </Grid.Resources> |
| 25 | + |
| 26 | + <Border Margin="30" Padding="15" BorderThickness="1.5" CornerRadius="10" BorderBrush="#8d8794"> |
| 27 | + |
| 28 | + <chart:SfChart HorizontalHeaderAlignment="Left" Palette="LightCandy" > |
| 29 | + |
| 30 | + <chart:SfChart.Header> |
| 31 | + <Border BorderBrush="White" Margin="0, 0, 0, 10"> |
| 32 | + <StackPanel Orientation="Horizontal"> |
| 33 | + <Grid Width="10" Background="CadetBlue" Margin="0, 8, 0, 5"/> |
| 34 | + <StackPanel> |
| 35 | + <TextBlock FontSize="18" Margin="5" |
| 36 | + Text="World Vehicle Production in Major Countries"/> |
| 37 | + <TextBlock FontSize="13" Margin="5" |
| 38 | + Text="Total passenger cars and commercial vehicles"/> |
| 39 | + </StackPanel> |
| 40 | + </StackPanel> |
| 41 | + </Border> |
| 42 | + </chart:SfChart.Header> |
| 43 | + |
| 44 | + <chart:SfChart.Legend> |
| 45 | + <chart:ChartLegend DockPosition="Bottom" IconHeight="14" IconWidth="14" FontSize="13" HorizontalAlignment="Left"/> |
| 46 | + </chart:SfChart.Legend> |
| 47 | + <!--Initialize the axis for chart--> |
| 48 | + <chart:SfChart.PrimaryAxis> |
| 49 | + <chart:CategoryAxis ShowGridLines="False" FontSize="13" TickLineSize="0" > |
| 50 | + |
| 51 | + </chart:CategoryAxis> |
| 52 | + </chart:SfChart.PrimaryAxis> |
| 53 | + |
| 54 | + <chart:SfChart.SecondaryAxis> |
| 55 | + <chart:NumericalAxis ShowGridLines="False" Visibility="Collapsed" > |
| 56 | + </chart:NumericalAxis> |
| 57 | + </chart:SfChart.SecondaryAxis> |
| 58 | + <chart:SfChart.Behaviors> |
| 59 | + <chart:ChartTooltipBehavior VerticalOffset="-10" > |
| 60 | + |
| 61 | + </chart:ChartTooltipBehavior> |
| 62 | + </chart:SfChart.Behaviors> |
| 63 | + |
| 64 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="Brazil" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="BrazilValue" > |
| 65 | + </chart:StackingArea100Series> |
| 66 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="China" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="ChinaValue" > |
| 67 | + </chart:StackingArea100Series> |
| 68 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="Germany" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="GermanyValue" > |
| 69 | + </chart:StackingArea100Series> |
| 70 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="India" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="IndiaValue" > |
| 71 | + </chart:StackingArea100Series> |
| 72 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="Japan" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="JapanValue" > |
| 73 | + </chart:StackingArea100Series> |
| 74 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="Uk" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="UKValue"> |
| 75 | + </chart:StackingArea100Series> |
| 76 | + <chart:StackingArea100Series TooltipTemplate="{StaticResource tooltipTemplate}" ShowTooltip="True" Label="United States" ItemsSource="{Binding Collection}" XBindingPath="Year" YBindingPath="USAValue"> |
| 77 | + </chart:StackingArea100Series> |
| 78 | + |
| 79 | + </chart:SfChart> |
| 80 | + </Border> |
| 81 | + </Grid> |
| 82 | +</Window> |
0 commit comments