0

有没有办法将 TextAnnotation 添加到 C# 中的图表控件中,其中注释出现在数据点后面?似乎没有办法将注释发送到后面。

4

2 回答 2

1

您是否尝试在 PrePaint 事件中更改文本注释的 Z-Order

检查此链接 http://support2.dundas.com/OnlineDocumentation/WebChart2005/Annotations.html

搜索“使用 Z 顺序”

于 2012-04-24T22:13:09.043 回答
0

我在点图中使用的肮脏解决方案。在其他一切之上重绘每个数据点。

Private Sub Chart1_Paint(chart1 As Chart, e As PaintEventArgs) Handles Chart1.Paint
    For Each chartSeries As Series In chart1.Series
        Dim ca As ChartArea = chart1.ChartAreas(chartSeries.ChartArea)
        For Each chartPoint As DataPoint In chartSeries.Points

            'Determine the position, size and color of the original datapoint.
            Dim x As Double = ca.AxisX.ValueToPixelPosition(chartPoint.XValue)
            Dim y As Double = ca.AxisY.ValueToPixelPosition(chartPoint.YValues.First)
            Dim b As New SolidBrush(chartSeries.Color)
            Dim width As Double = chartPoint.MarkerSize
            Dim r As New Rectangle(x - width / 2, y - width / 2, width, width)

            'Draw the new datapoint on top of the original (and on top of any annotations)
            e.Graphics.FillEllipse(b, r)
        Next
    Next
End Sub
于 2016-11-02T09:58:18.983 回答