/
StackingBar.xaml
117 lines (104 loc) · 5.91 KB
/
StackingBar.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
<democommon:DemoControl
x:Class="syncfusion.chartdemos.wpf.StackingBar100ChartDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
xmlns:democommon="clr-namespace:syncfusion.demoscommon.wpf;assembly=syncfusion.demoscommon.wpf"
xmlns:local="clr-namespace:syncfusion.chartdemos.wpf"
xmlns:skin="clr-namespace:Syncfusion.SfSkinManager;assembly=Syncfusion.SfSkinManager.WPF">
<democommon:DemoControl.DataContext>
<local:StackedBar100ViewModel />
</democommon:DemoControl.DataContext>
<Grid>
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Resources/ColorModel.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<chart:SfChart x:Name="StackingBar100Chart"
Margin="5" Palette="Custom">
<chart:SfChart.Header>
<TextBlock TextAlignment="Center" Text="Global Electric Vehicle Market Share" FontSize="17" Margin="0,10,0,0"/>
</chart:SfChart.Header>
<chart:SfChart.Legend>
<chart:ChartLegend IconHeight="13" IconWidth="13" FontSize="14" Padding="0,0,5,10" ToggleSeriesVisibility="True"/>
</chart:SfChart.Legend>
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis ShowGridLines="False">
<chart:CategoryAxis.LabelStyle>
<chart:LabelStyle FontSize="12.5"/>
</chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis ShowGridLines="False" PlotOffsetEnd="20">
<chart:NumericalAxis.LabelStyle>
<chart:LabelStyle FontSize="12.8"/>
</chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>
<chart:StackingBar100Series chart:ChartTooltip.EnableAnimation="True"
EnableAnimation="True"
ItemsSource="{Binding ElectricVehicleShare}"
Label="Tesla"
XBindingPath="Year"
YBindingPath="Tesla">
<chart:StackingBar100Series.AdornmentsInfo>
<chart:ChartAdornmentInfo AdornmentsPosition="TopAndBottom"
ShowLabel="True"
SegmentLabelFormat="0.#'%"/>
</chart:StackingBar100Series.AdornmentsInfo>
</chart:StackingBar100Series>
<chart:StackingBar100Series chart:ChartTooltip.EnableAnimation="True"
EnableAnimation="True"
ItemsSource="{Binding ElectricVehicleShare}"
Label="BYDAuto"
XBindingPath="Year"
YBindingPath="BYDAuto">
<chart:StackingBar100Series.AdornmentsInfo>
<chart:ChartAdornmentInfo AdornmentsPosition="TopAndBottom"
ShowLabel="True"
SegmentLabelFormat="0.#'%"/>
</chart:StackingBar100Series.AdornmentsInfo>
</chart:StackingBar100Series>
<chart:StackingBar100Series chart:ChartTooltip.EnableAnimation="True"
EnableAnimation="True"
ItemsSource="{Binding ElectricVehicleShare}"
Label="Volkswagen Group"
XBindingPath="Year"
YBindingPath="VolkswagenGroup">
<chart:StackingBar100Series.AdornmentsInfo>
<chart:ChartAdornmentInfo AdornmentsPosition="TopAndBottom"
ShowLabel="True"
SegmentLabelFormat="0.#'%"/>
</chart:StackingBar100Series.AdornmentsInfo>
</chart:StackingBar100Series>
<chart:StackingBar100Series chart:ChartTooltip.EnableAnimation="True"
EnableAnimation="True"
ItemsSource="{Binding ElectricVehicleShare}"
Label="Others"
XBindingPath="Year"
YBindingPath="Others">
<chart:StackingBar100Series.AdornmentsInfo>
<chart:ChartAdornmentInfo AdornmentsPosition="TopAndBottom"
ShowLabel="True"
SegmentLabelFormat="0.#'%"/>
</chart:StackingBar100Series.AdornmentsInfo>
</chart:StackingBar100Series>
</chart:SfChart>
<StackPanel Orientation="Horizontal" Margin="10,0,0,10" Grid.Row="1">
<TextBlock Text="Source: " FontSize="14"/>
<TextBlock Margin="3,0,0,0" FontStyle="Italic">
<Hyperlink Click="Hyperlink_Click"
FontSize="14"
TextDecorations="None">counterpointresearch.com</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</democommon:DemoControl>