PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Main/src/Xbap/DynamicDataDisplay.Xbap.Samples/Demos/v04/Markers/BarChart page/BarChartPage.xaml

#
XAML | 55 lines | 51 code | 4 blank | 0 comment | 0 complexity | 9c056a7d75ef8c4ebd5d667960b4640b MD5 | raw file
 1<Page x:Class="NewMarkersSample.Pages.BarChartPage"
 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:local="clr-namespace:NewMarkersSample.Pages" Loaded="Page_Loaded"
 6    Title="Bar Chart">
 7	<Grid>
 8		<Grid.RowDefinitions>
 9			<RowDefinition Height="*"/>
10			<RowDefinition Height="Auto"/>
11		</Grid.RowDefinitions>
12
13		<d3:ChartPlotter Name="plotter" Visible="-1,-0.1 11,5">
14			<d3:ChartPlotter.Resources>
15				<local:HeightToFillConverter x:Key="converter"/>
16				<local:TooltipConverter FormatString="[0:F2]: [1:F2]->[2:F2]" x:Key="tooltipConverter"/>
17				<d3:BrushHSBConverter SaturationDelta="0.8" LightnessDelta="1.6" x:Key="lighterConverter"/>
18				<d3:BackgroundToForegroundConverter x:Key="backToForeConv"/>
19			</d3:ChartPlotter.Resources>
20
21			<d3:BarChart Name="barChart">
22				<d3:TemplateMarkerGenerator>
23					<DataTemplate>
24						<Rectangle Width="30" Fill="{Binding YMax, Converter={StaticResource converter}}"
25								   d3:ViewportPanel.Y="{Binding YMin}" 
26								   d3:ViewportPanel.X="{Binding X}"
27								   d3:ViewportPanel.ViewportHeight="{Binding YMax}"
28								   d3:ViewportPanel.ViewportVerticalAlignment="Bottom">
29							<d3:LiveToolTipService.ToolTip>
30								<d3:LiveToolTip BorderBrush="DarkGray" Background="{d3:SelfBinding Path=Owner.Fill, Converter={StaticResource lighterConverter}}"
31												TextBlock.Foreground="{d3:SelfBinding Path=Owner.Fill, Converter={StaticResource backToForeConv}}">
32									<TextBlock>
33										<TextBlock.Text>
34											<MultiBinding Converter="{StaticResource tooltipConverter}">
35												<Binding Path="X"/>
36												<Binding Path="YMin"/>
37												<Binding Path="YMax"/>
38											</MultiBinding>
39										</TextBlock.Text>
40									</TextBlock>
41								</d3:LiveToolTip>
42							</d3:LiveToolTipService.ToolTip>
43						</Rectangle>
44					</DataTemplate>
45				</d3:TemplateMarkerGenerator>
46			</d3:BarChart>
47
48			<Grid Canvas.Top="10" Canvas.Left="10">
49				<Rectangle RadiusX="2" RadiusY="2" Stroke="LightGray" StrokeThickness="1" Fill="White" Opacity="0.7"/> 
50				<TextBlock Margin="5" FontSize="14">Try to move <Run Foreground="Green">mouse</Run> over animated bars.</TextBlock>
51			</Grid>
52			
53		</d3:ChartPlotter>
54	</Grid>
55</Page>