问题描述
我将实时图表用于折线图和柱状图。
我已启用数据标签功能。
但我使用深色作为背景。它使数据标签看起来很模糊。
我找不到可以更改数据标签颜色的地方。有谁知道怎么改?
在 C# 中
ProductionAndTargetCollection = new SeriesCollection
{
new Lineseries
{
Title = "Target",Values = DailyTargetValue,DataLabels = true,Linesmoothness = 0
},new ColumnSeries
{
Title = "Production",Values = DailyProductionValue
}
};
在 WPF 中
<lvc:CartesianChart Name="MidRightChart" Series="{Binding ProductionAndTargetCollection}" @R_502_6422@ableAnimations="True">
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelsRotation="0" Labels="{Binding ProductionAndTargetLabels}" Foreground="White" Position="LeftBottom">
<lvc:Axis.Separator >
<lvc:Separator Step="1"></lvc:Separator>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="White" MinValue="0"/>
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
解决方法
您应该设置 Foreground
的 Series
属性以更改数据标签的颜色:
new ColumnSeries
{
Title = "Production",DataLabels = true,Values = DailyProductionValue,Foreground = Brushes.Red // <--
}