source: trunk/CrypPluginBase/Utils/Graphics/Diagrams/Histogram/HistogramChart.xaml @ 1666

Last change on this file since 1666 was 1666, checked in by Arno Wacker, 11 years ago

Plugins

  • Removed copy local for CrypPluginBase from P2PEditor, PeerToPeer, PeerToPeerBaseProxy, Soap, VigenereAnalyzer, WebService, WorkspaceManager

CrypPluginBase:

  • Added Utils for diagrams: Initial version for a generic histogram control added (working, but not scaling correctly)

Autocorrelation:

  • Added WPF UserControl for presentation
  • Exemplary added the Histogram from CrypPluginBase to the presentation of autocorrelation (just demo, no functionality)
File size: 3.9 KB
Line 
1<UserControl x:Class="Cryptool.PluginBase.Utils.Graphics.Diagrams.Histogram.HistogramChart"
2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4    xmlns:local="clr-namespace:Cryptool.PluginBase.Utils.Graphics.Diagrams.Histogram"
5    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7    mc:Ignorable="d"
8    d:DesignHeight="200" d:DesignWidth="400"
9    Background="Transparent"
10    SnapsToDevicePixels="True"
11    HorizontalAlignment="Stretch"
12    VerticalAlignment="Stretch"
13    Height="Auto"
14    Width="Auto"
15    x:Name="HistogramChartControl" >
16   
17        <UserControl.Resources>
18
19        <local:HistogramDataSource x:Key="source"/>
20
21
22        <DataTemplate x:Key="template" >
23
24            <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" >
25                <Rectangle Width="3"/>
26                <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
27                   
28                    <TextBlock HorizontalAlignment="Center" Text="{Binding Path=Percent}">
29                    </TextBlock>
30
31                    <Rectangle Height="3"/>
32
33                    <Rectangle Height="{Binding Path=Amount}" Width="20" StrokeThickness="1" Stroke="Beige" RadiusX="5" RadiusY="5" ToolTip="{Binding Path=Caption}" >
34                        <Rectangle.BitmapEffect>
35                            <DropShadowBitmapEffect />
36                        </Rectangle.BitmapEffect>
37
38                        <Rectangle.Fill>
39                            <RadialGradientBrush >
40                                <GradientStop Color="Turquoise" Offset="0" />
41                                <GradientStop Color="DarkBlue" Offset="1" />
42                            </RadialGradientBrush>
43                        </Rectangle.Fill>
44
45                    </Rectangle>
46
47                    <Rectangle Height="5" />
48
49                    <TextBlock HorizontalAlignment="Center" Text="{Binding Path=Caption}"/>
50       
51                </StackPanel>               
52            </StackPanel>
53           
54
55        </DataTemplate>
56
57
58        <ItemsPanelTemplate x:Key="panelTemplate">
59            <StackPanel Orientation="Horizontal"/>
60        </ItemsPanelTemplate>
61
62    </UserControl.Resources>
63   
64   
65         
66    <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto"  ScrollViewer.HorizontalScrollBarVisibility="Auto"
67                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
68        <Grid x:Name="chart" Background="LightYellow" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
69            <Grid.ColumnDefinitions>
70                <ColumnDefinition Width="Auto" />
71            </Grid.ColumnDefinitions>
72            <Grid.RowDefinitions>
73                <RowDefinition Height="Auto" />
74                <RowDefinition Height="1*" />
75            </Grid.RowDefinitions>
76           
77            <Grid.LayoutTransform>
78                <ScaleTransform ScaleX="1" ScaleY="1"/>
79            </Grid.LayoutTransform>
80         
81           <TextBlock x:Name="chartHeadline" TextAlignment="Center" Grid.Row="0" Grid.Column="0" FontSize="20" Foreground="DarkBlue"  FontFamily="Academy" OpacityMask="Turquoise" Text="No data available yet!" ></TextBlock>
82
83           <ItemsControl x:Name="chartBars" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"           
84             ItemsSource="{Binding Source={StaticResource source},Path=ValueCollection}"
85             ItemTemplate="{StaticResource template}" ItemsPanel="{StaticResource panelTemplate}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
86           </ItemsControl>
87
88        </Grid>
89    </ScrollViewer>
90       
91</UserControl>
92   
Note: See TracBrowser for help on using the repository browser.