/
StackingColumnChart.xaml
156 lines (136 loc) · 9.49 KB
/
StackingColumnChart.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<Page
x:Class="Syncfusion.ChartDemos.WinUI.Views.StackingColumnChart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Syncfusion.ChartDemos.WinUI"
xmlns:chart="using:Syncfusion.UI.Xaml.Charts"
xmlns:common="using:Syncfusion.DemosCommon.WinUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Transparent">
<Page.DataContext>
<local:StackedChartViewModel />
</Page.DataContext>
<Grid>
<Grid.Resources>
<ResourceDictionary>
<Style TargetType="Line" x:Name="axisStyle">
<Setter Property="StrokeThickness" Value="0"/>
<Setter Property="Stroke" Value="Transparent"/>
</Style>
<Style TargetType="Line" x:Name="majorAxisStyle">
<Setter Property="StrokeThickness" Value="10"/>
<Setter Property="Stroke" Value="Transparent"/>
</Style>
<DataTemplate x:Key="headerTemplate">
<TextBlock Text="Sales" Padding="0,0,0,10"/>
</DataTemplate>
</ResourceDictionary>
</Grid.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto" VerticalScrollMode="Auto">
<common:DemoLayout x:Name="demo" HeaderText="This stacked column chart demonstrates the mobile game market by country from 2013 to 2017.">
<common:DemoLayout.Example>
<chart:SfCartesianChart
x:Name="Chart"
Header="Mobile Game Market by Country"
Height="420"
HorizontalAlignment="Center">
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelPlacement="BetweenTicks" ShowMajorGridLines="False" MajorTickStyle="{StaticResource axisStyle}"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Minimum="0" Interval="100" Maximum="500" AxisLineStyle="{StaticResource axisStyle}" MajorTickStyle="{StaticResource axisStyle}"
HeaderTemplate="{StaticResource headerTemplate}">
<chart:NumericalAxis.LabelStyle>
<chart:LabelStyle LabelFormat="0'B" FontSize="12"/>
</chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Legend>
<chart:ChartLegend IconWidth="13" IconHeight="13" Padding="0,0,65,0"/>
</chart:SfCartesianChart.Legend>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}" Label="UK"
ShowDataLabels="True" XBindingPath="Year" YBindingPath="UK" LegendIcon="Circle"
Fill="{ThemeResource SeriesBrush5}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner"/>
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}" Label="Germany"
ShowDataLabels="True" XBindingPath="Year" YBindingPath="Germany" LegendIcon="Circle"
Fill="{ThemeResource SeriesBrush4}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner" />
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}" Label="France"
ShowDataLabels="True" XBindingPath="Year" YBindingPath="France" LegendIcon="Circle"
Fill="{ThemeResource SeriesBrush6}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner" />
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}" Label="Italy"
ShowDataLabels="True" XBindingPath="Year" YBindingPath="Italy" LegendIcon="Circle"
Fill="{ThemeResource SeriesBrush7}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner" Margin="0,0,0,3" />
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
</chart:SfCartesianChart>
</common:DemoLayout.Example>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
<chart:SfCartesianChart x:Name="Chart" Header="Mobile Game Market by Country">
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelPlacement="BetweenTicks" ShowMajorGridLines="False"
MajorTickStyle="{StaticResource axisStyle}">
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Maximum="500" Minimum="0" Interval="100"
AxisLineStyle="{StaticResource axisStyle}" MajorTickStyle="{StaticResource axisStyle}"
HeaderTemplate="{StaticResource headerTemplate}">
<chart:NumericalAxis.LabelStyle>
<chart:LabelStyle LabelFormat="0'B" FontSize="12"/>
</chart:NumericalAxis.LabelStyle>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Legend>
<chart:ChartLegend IconWidth="13" IconHeight="13"/>
</chart:SfCartesianChart.Legend>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}"
XBindingPath="Year" YBindingPath="UK" Label="UK"
ShowDataLabels="True" LegendIcon="Circle" Fill="{ThemeResource SeriesBrush5}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner"/>
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}"
XBindingPath="Year" YBindingPath="Germany" Label="Germany"
ShowDataLabels="True" LegendIcon="Circle" Fill="{ThemeResource SeriesBrush4}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner"/>
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}"
XBindingPath="Year" YBindingPath="France" Label="France"
ShowDataLabels="True" LegendIcon="Circle" Fill="{ThemeResource SeriesBrush6}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner"/>
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
<chart:StackedColumnSeries EnableAnimation="True" ItemsSource="{Binding StackedColumndData}"
XBindingPath="Year" YBindingPath="Italy" Label="Italy"
ShowDataLabels="True" LegendIcon="Circle" Fill="{ThemeResource SeriesBrush7}">
<chart:StackedColumnSeries.DataLabelSettings>
<chart:CartesianDataLabelSettings Position="Inner" Margin="0,0,0,3"/>
</chart:StackedColumnSeries.DataLabelSettings>
</chart:StackedColumnSeries>
</chart:SfCartesianChart>
</x:String>
</common:DemoLayout.Xaml>
</common:DemoLayout>
</ScrollViewer>
</Grid>
</Page>