在我的 Syncfusion WPF 应用程序中,ChartTrackBallBehavior 显示我可以向 ChartTrackBallStyle 添加一些样式。该样式没有任何文档。我不知道可以在图表中设置什么。
有人使用过此控件并设置标签样式以匹配他们的公司外观吗?我需要更改轴中显示的标签的外观。到目前为止,我已经找到了以下 Style 的 Setter
,它改变了球的外观,但不改变标签。
<sfc:SfChart.Behaviors>
<sfc:ChartTrackBallBehavior ShowLine="True" LabelHorizontalAlignment="Center" LabelVerticalAlignment="Near" >
<sfc:ChartTrackBallBehavior.ChartTrackBallStyle>
<Style TargetType="sfc:ChartTrackBallControl" >
<Setter Property="Control.Visibility" Value="Visible" />
<Setter Property="Control.Background" Value="AliceBlue" />
<Setter Property="Control.FontSize" Value="6" />
</Style>
</sfc:ChartTrackBallBehavior.ChartTrackBallStyle>
</sfc:ChartTrackBallBehavior>
</sfc:SfChart.Behaviors>
最佳答案
我们可以使用 ChartAxis 的 TrackBallLabelTemplat 属性来自定义轨迹球标签样式,如下面的代码片段所示
<sfchart:SfChart.PrimaryAxis>
<sfchart:NumericalAxis ShowTrackBallInfo="True" >
<sfchart:NumericalAxis.TrackBallLabelTemplate>
<DataTemplate >
<Border BorderThickness="2" BorderBrush="Black" Padding="3" Background="White">
<TextBlock FontSize="16" Text="{Binding ValueX}" Foreground="Black"></TextBlock>
</Border>
</DataTemplate>
</sfchart:NumericalAxis.TrackBallLabelTemplate>
</sfchart:NumericalAxis>
</sfchart:SfChart.PrimaryAxis>
关于c# - Syncfusion 图表轨迹球风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26854121/