2017-05-04 58 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