C# 防止图表数据标签被遮挡

C# 防止图表数据标签被遮挡,c#,.net,charts,label,mschart,C#,.net,Charts,Label,Mschart,我正在使用.net构建一个应用程序来自动生成图表,并将它们从数据保存到内存流中。我遇到了数据标签被其他系列模糊的问题。我启用了以下功能 series.SmartLabelStyle.Enabled = true series.SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes series.SmartLabelStyle.IsMarkerOverlappingAllowed = false series.Sma

我正在使用.net构建一个应用程序来自动生成图表,并将它们从数据保存到内存流中。我遇到了数据标签被其他系列模糊的问题。我启用了以下功能

series.SmartLabelStyle.Enabled = true
series.SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes
series.SmartLabelStyle.IsMarkerOverlappingAllowed = false
series.SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Right
var index = series1.Points.AddXY(date.ToOADate(), value)
series2.Points.AddXY(date.ToOADate(), value)
series3.Points.AddXY(date.ToOADate(), value)

if (some condition)
{
    series1.Points.[index].IsValueShownAsLabel = true
    series2.Points.[index].IsValueShownAsLabel = true
    series3.Points.[index].IsValueShownAsLabel = true
}
而数据标签仍可能被其他数据系列所掩盖,如下所示

所以问题是,如何使所有数据标签可见和清晰

提前谢谢

编辑:如果这很重要,我会在添加数据点时有选择地在序列上启用数据标签

编辑2:我使用
points.AddXY(SomeDate.ToOADate(),SomeValue)
逐个添加数据点。我遍历数据,并为每个系列添加一个点,并在某些条件下启用数据标签。关键部分如下所示

series.SmartLabelStyle.Enabled = true
series.SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.Yes
series.SmartLabelStyle.IsMarkerOverlappingAllowed = false
series.SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Right
var index = series1.Points.AddXY(date.ToOADate(), value)
series2.Points.AddXY(date.ToOADate(), value)
series3.Points.AddXY(date.ToOADate(), value)

if (some condition)
{
    series1.Points.[index].IsValueShownAsLabel = true
    series2.Points.[index].IsValueShownAsLabel = true
    series3.Points.[index].IsValueShownAsLabel = true
}

我为每个系列设置SmartLabelStyle,然后将系列添加到图表中,然后将数据点添加到系列中。

这些系列是什么图表类型?@TaW Line and Column.OK。(我问是因为FastLine不支持SmartLabels…)-我想这与你添加积分的方式有关,但我真的不知道。当然,我不能复制,这将是最有帮助的…@TaW谢谢你的澄清。我更新了问题以获得更多信息。这些系列是什么图表类型?@TaW Line and Column.OK。(我问是因为FastLine不支持SmartLabels…)-我想这与你添加积分的方式有关,但我真的不知道。当然,我不能复制,这将是最有帮助的…@TaW谢谢你的澄清。我更新了问题以获得更多信息。