2011-10-12 81 views
1

我无法弄清楚如何样式化图表上的Y轴标签(Silverlight Toolkit)。有没有人有一个简单的例子来说明如何做到这一点?所有在野外的例子似乎都是在2010年之前,当时图表API不同。Silverlight工具包图表Y轴标签样式

谢谢,

麦克

回答

1

下面是一些示例代码改变所述Y轴显示在小时而不是分钟标签和改变字体大小设置为8(SecondsToHours转换器代码不包括)。你可以在Style中做很多其他类型的格式。这应该有助于你开始。

<Style x:Key="HoursLabel" TargetType="{x:Type charting:AxisLabel}"> 
    <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="{x:Type charting:AxisLabel}"> 
       <TextBlock Text="{Binding Converter={StaticResource SecondsToHoursConverter}}" FontSize="8" /> 
      </ControlTemplate> 
     </Setter.Value> 
    </Setter> 
</Style> 

<charting:Chart.Axes> 
    <charting:LinearAxis Orientation="Y" Interval="1" Minimum="0" Maximum="24" AxisLabelStyle="{StaticResource HoursLabel}" /> 
</charting:Chart.Axes>