/
StepLineChart.xaml
102 lines (88 loc) · 5.59 KB
/
StepLineChart.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
<Page
x:Class="Syncfusion.ChartDemos.WinUI.Views.StepLineChart"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:chart="using:Syncfusion.UI.Xaml.Charts"
xmlns:common="using:Syncfusion.DemosCommon.WinUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Syncfusion.ChartDemos.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="Transparent"
mc:Ignorable="d">
<Grid>
<Grid.Resources>
<Style TargetType="Line" x:Name="axisStyle">
<Setter Property="StrokeThickness" Value="0"/>
<Setter Property="Stroke" Value="Transparent"/>
</Style>
</Grid.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto" VerticalScrollMode="Auto">
<common:DemoLayout HeaderText="This step line chart showcases the percentage of electricity production from oil, gas, and coal sources between Canada and France from 2000 to 2010.">
<common:DemoLayout.DataContext>
<local:StepLineChartViewModel />
</common:DemoLayout.DataContext>
<common:DemoLayout.Example>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<chart:SfCartesianChart x:Name="Chart" Header="Electricity-Production" Height="420"
PaletteBrushes="{ThemeResource ChartPalette}">
<chart:SfCartesianChart.Legend>
<chart:ChartLegend Padding="0,0,40,0"/>
</chart:SfCartesianChart.Legend>
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowMajorGridLines="False" Interval="2"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Minimum="0" Maximum="35" AxisLineStyle="{StaticResource axisStyle}" MajorTickStyle="{StaticResource axisStyle}">
<chart:NumericalAxis.LabelStyle>
<chart:LabelStyle LabelFormat="0'%" FontSize="13"/>
</chart:NumericalAxis.LabelStyle>
</chart:NumericalAxis>
</chart:SfCartesianChart.YAxes>
<chart:StepLineSeries EnableAnimation="True" ItemsSource="{Binding CanadaData}" Label="Canada" EnableTooltip="True"
XBindingPath="Name" YBindingPath="Value" LegendIcon="Circle" />
<chart:StepLineSeries EnableAnimation="True" ItemsSource="{Binding FranceData}" Label="France" EnableTooltip="True"
XBindingPath="Name" YBindingPath="Value" LegendIcon="Circle" />
</chart:SfCartesianChart>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,10,0,0">
<TextBlock Text="Source: "/>
<TextBlock TextWrapping="WrapWholeWords" Margin="3,0,0,0">
<Hyperlink NavigateUri="https://data.worldbank.org/indicator/EG.ELC.FOSL.ZS?end=2010&locations=CA-FR&start=2000" FontStyle="Italic" UnderlineStyle="None">The World Bank Group</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</common:DemoLayout.Example>
<common:DemoLayout.Xaml>
<x:String xml:space="preserve">
<chart:SfCartesianChart x:Name="Chart" Header="Electricity-Production"
PaletteBrushes="{ThemeResource ChartPalette}">
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis ShowMajorGridLines="False" Interval="2"/>
</chart:SfCartesianChart.XAxes>
<chart:SfCartesianChart.YAxes>
<chart:NumericalAxis Minimum="0" AxisLineStyle="{StaticResource axisStyle}"
MajorTickStyle="{StaticResource axisStyle}" Maximum="35">
<chart:NumericalAxis.LabelStyle>
<chart:LabelStyle LabelFormat="0'%" FontSize="13"/>
</chart:NumericalAxis.LabelStyle>
<chart:NumericalAxis/>
</chart:SfCartesianChart.YAxes>
<chart:SfCartesianChart.Legend>
<chart:ChartLegend/>
</chart:SfCartesianChart.Legend>
<chart:StepLineSeries ItemsSource="{Binding CanadaData}" XBindingPath="Name" YBindingPath="Value"
EnableAnimation="True" Label="Canada" EnableTooltip="True"
LegendIcon="Circle"/>
<chart:StepLineSeries ItemsSource="{Binding FranceData}" XBindingPath="Name" YBindingPath="Value"
Label="France" EnableTooltip="True" EnableAnimation="True"
LegendIcon="Circle"/>
</chart:SfCartesianChart>
</x:String>
</common:DemoLayout.Xaml>
</common:DemoLayout>
</ScrollViewer>
</Grid>
</Page>