我创建了一个带有单个水平条的堆积条形图。 我想在每两个堆栈连接的位置上方显示一个注释或标记,如图所示。 我的条形图显示正常,但无法显示注释。 L1,L2,L3和L4的值已在代码中提前设置
Dim BeamSeries1, BeamSeries2, BeamSeries3, BeamSeries4, BeamSeries5 As New Series
BeamSeries1.ChartType = SeriesChartType.StackedBar
BeamSeries2.ChartType = SeriesChartType.StackedBar
BeamSeries3.ChartType = SeriesChartType.StackedBar
BeamSeries4.ChartType = SeriesChartType.StackedBar
If L1 > 0 Then
BeamSeries1.Points.AddY(L1)
cht_Beam.Series.Add(BeamSeries1)
End If
If L2 > 0 Then
BeamSeries2.Points.AddY(L2 - L1)
cht_Beam.Series.Add(BeamSeries2)
End If
If L3 > 0 Then
BeamSeries3.Points.AddY(L3 - L2)
cht_Beam.Series.Add(BeamSeries3)
End If
If L4 > 0 Then
BeamSeries4.Points.AddY(L4 - L3)
cht_Beam.Series.Add(BeamSeries4)
End If
End With
'annotate
Dim AA As New ArrowAnnotation
AA.LineWidth = 2
AA.AnchorDataPoint = BeamSeries1.Points.First
AA.Visible = True
AA.ArrowStyle = ArrowStyle.Simple
cht_Beam.Annotations.Add(AA)
'marker
BeamSeries1.MarkerStyle = MarkerStyle.Triangle
BeamSeries1.Points.First.MarkerStyle = MarkerStyle.Triangle
在上面的代码中,我尝试向图表的第一点添加箭头注释和标记,但均未显示。我既不希望注释也不需要标记。