2017-05-04 23 views
0

我正在使用mschart的VB.NET。我正在使用ErroBar圖表類型,但我無法標出所有的值(中,上,下)。當我設置chart.Series("ErrorBar").IsValueShownAsLabel = True時,只顯示上限值。 enter image description here錯誤欄不能顯示mschart中的所有值

我想顯示中心值,上限值和下限值。

預先感謝

+1

看起來可能會幫助[使用ASP.NET圖表控件的工具提示的簡單圖表](https://www.codeproject.com/tips/465155/simple-chart-with-tooltip-using-asp -net-chart-cont)[ErrorBarChart.cs - referencesource.microsoft.com](https://referencesource.microsoft.com/#System.Web.DataVisualization/Common/ChartTypes/ErrorBarChart.cs) –

+0

感謝Wojciech Wojtulewski爲您的快速反應!找到你給我的一個非常有用的參考,但是我發現代碼對於我想要的有點複雜,所以我決定使用註釋編寫一個簡單的解決方案。 – mago

回答

0

將溶液通過我的是如在下面的代碼

Dim Media1 As New RectangleAnnotation() 
    Media1.BackColor = Color.Yellow 
    Media1.Text = FormatNumber(D20, 4) 
    Dim point As PointF = New PointF(chart.ChartAreas(0).AxisX.ValueToPosition(1), chart.ChartAreas(0).AxisY.ValueToPosition(D20)) 
    Media1.AnchorX = point.X + 10 
    Media1.AnchorY = point.Y + 2 
    Media1.AllowMoving = True 

    Dim L1 As New RectangleAnnotation() 
    L1.BackColor = Color.Yellow 
    L1.Text = FormatNumber(D20 - result * My.Settings("IncertezaDensidade20")/2, 4) 
    point = New PointF(chart.ChartAreas(0).AxisX.ValueToPosition(1), chart.ChartAreas(0).AxisY.ValueToPosition(D20 - result * My.Settings("IncertezaDensidade20")/2)) 
    L1.AnchorX = point.X 
    L1.AnchorY = point.Y + 10 
    L1.AllowMoving = True 

    Dim L2 As New RectangleAnnotation() 
    L2.BackColor = Color.Yellow 
    L2.Text = FormatNumber(D20 + result * My.Settings("IncertezaDensidade20")/2, 4) 
    point = New PointF(chart.ChartAreas(0).AxisX.ValueToPosition(1), chart.ChartAreas(0).AxisY.ValueToPosition(D20 + result * My.Settings("IncertezaDensidade20")/2)) 
    L2.AnchorX = point.X 
    L2.AnchorY = point.Y - 5 
    L2.AllowMoving = True 

可以看出的圖表現在更簡單的一個使用註釋,可以看出以下

enter image description here