PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/Main/src/Xbap/DynamicDataDisplay.Xbap.Samples/Demos/v04/Markers/PieChart page/PieChartPage.xaml

#
XAML | 96 lines | 64 code | 8 blank | 24 comment | 0 complexity | e68dc9fa2063014fb14eceee92065166 MD5 | raw file
 1<Page x:Class="NewMarkersSample.Pages.PieChartPage"
 2	  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4	  xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
 5	  xmlns:wpf="http://schemas.microsoft.com/wpf/2008/toolkit"
 6	  Title="Pie Chart" Loaded="Page_Loaded" Unloaded="Page_Unloaded">
 7	<Grid Name="root">
 8		<Grid.ColumnDefinitions>
 9			<ColumnDefinition Width="*"/>
10			<ColumnDefinition Width="Auto"/>
11		</Grid.ColumnDefinitions>
12
13		<Grid.RowDefinitions>
14			<RowDefinition Height="*"/>
15			<RowDefinition Height="Auto"/>
16		</Grid.RowDefinitions>
17
18		<d3:ChartPlotter Grid.Row="0" Name="plotter">
19			<d3:ViewportUIContainer>
20				<d3:PieChart Name="chart" Width="500" Height="500" 
21							 IndependentValuePath="Income" DependentValuePath="CityName" ItemsSource="{Binding}" 
22							 Canvas.Left="10" Canvas.Top="10"
23							 StartAngle="{Binding Path=Value, ElementName=startAngleSlider}">
24					<d3:PieChart.Resources>
25						<d3:BrushHSBConverter SaturationDelta="0.8" LightnessDelta="1.6" x:Key="lighterConverter"/>
26						<d3:NegativeRotateTransformConverter x:Key="transformConverter"/>
27					</d3:PieChart.Resources>
28
29					<d3:PieChart.MarkerTemplate>
30						<DataTemplate>
31							<d3:PieChartItem>
32								<d3:LiveToolTipService.ToolTip>
33									<d3:LiveToolTip Opacity="0.8" Background="{d3:SelfBinding Path=Owner.Background, Converter={StaticResource lighterConverter}}"
34											RenderTransform="{d3:SelfBinding Path=Owner.RenderTransform, Converter={StaticResource transformConverter}}"
35											RenderTransformOrigin="0,0">
36										<TextBlock>
37											<Bold>City:</Bold> <TextBlock Text="{Binding CityName}"/>
38											<LineBreak/>
39											<Bold>Income:</Bold> $<TextBlock Text="{Binding Income}"/>
40										</TextBlock>
41									</d3:LiveToolTip>
42								</d3:LiveToolTipService.ToolTip>
43							</d3:PieChartItem>
44						</DataTemplate>
45					</d3:PieChart.MarkerTemplate>
46				</d3:PieChart>
47			</d3:ViewportUIContainer>
48
49			<RepeatButton Content="Add random item" Canvas.Right="160" Canvas.Bottom="10" Click="addRandomItemBtn_Click"/>
50
51			<GroupBox Header="Legend style" Canvas.Right="270" Canvas.Bottom="10">
52				<StackPanel Background="White">
53					<RadioButton Content="Default style" Name="defaultStyle" IsChecked="True" Checked="defaultStyle_Checked"/>
54					<RadioButton Content="No scroll style" Name="noScrollStyle" Checked="noScrollStyle_Checked"/>
55				</StackPanel>
56			</GroupBox>
57		</d3:ChartPlotter>
58
59		<!--<d3:PieChart Name="chart2" IndependentValuePath="Income" Grid.Row="0" Visibility="Hidden">
60			<d3:PieChart.Resources>
61				<d3:BrushHSBConverter SaturationDelta="0.8" LightnessDelta="1.6" x:Key="lighterConverter"/>
62				<d3:NegativeRotateTransformConverter x:Key="transformConverter"/>
63			</d3:PieChart.Resources>
64
65			<d3:PieChart.MarkerTemplate>
66				<DataTemplate>
67					<d3:PieChartItem Style="{x:Static d3:PieChartStyles.Donut}">
68						<d3:LiveTooltipService.ToolTip>
69							<d3:LiveTooltip Background="{d3:SelfBinding Path=Owner.Background, Converter={StaticResource lighterConverter}}"
70											RenderTransform="{d3:SelfBinding Path=Owner.RenderTransform, Converter={StaticResource transformConverter}}"
71											RenderTransformOrigin="0,0">
72								<TextBlock>
73									<Bold>City:</Bold> <TextBlock Text="{Binding CityName}"/>
74									<LineBreak/>
75									<Bold>Income:</Bold> $<TextBlock Text="{Binding Income}"/>
76								</TextBlock>
77							</d3:LiveTooltip>
78						</d3:LiveTooltipService.ToolTip>
79					</d3:PieChartItem>
80				</DataTemplate>
81			</d3:PieChart.MarkerTemplate>
82		</d3:PieChart>-->
83
84		<ScrollViewer Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" VerticalScrollBarVisibility="Visible">
85			<wpf:DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" 
86					  CanUserDeleteRows="True">
87				<wpf:DataGrid.Columns>
88					<wpf:DataGridTextColumn Header="City" Binding="{Binding CityName}"/>
89					<wpf:DataGridTextColumn Header="Income" Binding="{Binding Income, StringFormat=F2}"/>
90				</wpf:DataGrid.Columns>
91			</wpf:DataGrid>
92		</ScrollViewer>
93
94		<Slider Minimum="0" Maximum="360" Name="startAngleSlider" Grid.Row="1" Grid.Column="0" Margin="5"/>
95	</Grid>
96</Page>