有没有人知道如何在WPFToolkit图表中关闭普通LineSeries的数据点?我发现它们非常烦人,并且对我的目的没有用处,但我在类本身上找不到简单的属性或任何东西。
有没有人知道如何在WPFToolkit图表中关闭普通LineSeries的数据点?我发现它们非常烦人,并且对我的目的没有用处,但我在类本身上找不到简单的属性或任何东西。
你想要隐藏它们吗?
只需将空的ControlTemplate
设置到Template
属性中即可实现。
这是一个示例:
<Window.Resources>
<Style x:Key="InvisibleDataPoint" TargetType="{x:Type charting:DataPoint}">
<Setter Property="Background" Value="Blue"/>
<Setter Property="Template" Value="{x:Null}"/>
</Style>
</Window.Resources>
<Grid>
<charting:Chart>
<charting:LineSeries ItemsSource="{Binding ChartItems}" IndependentValuePath="XValue" DependentValuePath="YValue"
DataPointStyle="{StaticResource InvisibleDataPoint}"/>
</charting:Chart>
</Grid>
虽然这些点是看不见的,但你可以设置其他属性,比如Background
,从而改变图表的外观。
LineSeries
时,可以使用此答案的解决方法 - https://dev59.com/F0vSa4cB1Zd3GeqPhMmU#11358310,以删除数据点。 - Pieniadz