是否可以在绑定图表中显示注释?我能够创建一个绑定图表但是当我试图显示一个注释时,它根本不起作用。下面是我使用的代码。
con = ConnectDB()
Try
con.Open()
da = New SqlDataAdapter("WITH tempLotTracking AS(SELECT TOP 5 * FROM tblLotTracking ORDER BY LotTrackingID DESC) SELECT * FROM tempLotTracking ORDER BY LotTrackingID", con)
da.Fill(ds, "tblLotTracking")
con.Close()
Catch ex As Exception
con.Close()
MsgBox("Error connecting to database.", MsgBoxStyle.Critical)
MsgBox(ex.ToString)
Exit Sub
End Try
Chart1.Series("Series1").XValueMember = "WorkWeek"
Chart1.Series("Series1").YValueMembers = "TotalIssues"
Dim myLine As LineAnnotation = New LineAnnotation()
myLine.Name = "myLine"
myLine.X = 3
myLine.Y = 3
Chart1.Annotations.Add(myLine)
Chart1.DataSource = ds.Tables("tblLotTracking")
答案 0 :(得分:0)
您可能需要在图表注释上放置锚点: -
myLine.AnchorX = some_value
myLine.AnchorY = some_other_value
还要检查你没做我做的事情并以背景颜色绘制注释文本。