Thursday, July 07, 2011

Silverlight 4 DataVisualization Chart Control - How to place values above the bar

ChartTextAboveBar.png

רכיב Microsoft.Windows.Controls.DataVisualization של Silverlight 4 כולל Charts - גרפים:

בכדי להציג את הערכים מעל ה-Bars, ניתן לממש באופן הבא בקובץ ה-XAML (קטע חלקי):

xmlns:charting="clr-namespace:Microsoft.Windows.Controls.DataVisualization.Charting;
                                     assembly=Microsoft.Windows.Controls.DataVisualization"

<charting:Chart.Series>
   <charting:ColumnSeries ItemsSource="{Binding}" DependentValueBinding="{Binding Value}"
          IndependentValueBinding="{Binding Key}">
      <charting:ColumnSeries.DataPointStyle>
         <Style TargetType="charting:ColumnDataPoint">
            <Setter Property="Template">
               <Setter.Value>
                  <ControlTemplate TargetType="charting:ColumnDataPoint">
                     <Border Background="Navy" ToolTipService.ToolTip="{Binding Value}"
              BorderBrush="{TemplateBinding orderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                           <TextBlock x:Name="ColumnValue" Text="{Binding Value}" TextAlignment="Center"
                       HorizontalAlignment="Stretch" Margin="0,-14,0,0" Foreground="Black" FontSize="10" />

Read more: Dudi Nissan's Blog
QR: silverlight-4-datavisualization-chart-control-how-to-place-values-above-the-bar.aspx

Posted via email from Jasper-Net