【发布时间】:2017-04-14 06:31:14
【问题描述】:
我在图形控件中添加了折线注释。但它在 Addline() 方法中的给定数据点中没有正确对齐。
PolylineAnnotation annotation = new PolylineAnnotation();
annotation.AxisX = chart1.ChartAreas[0].AxisX;
annotation.AxisY = chart1.ChartAreas[0].AxisY;
annotation.AnchorX = 0;
annotation.AnchorY = 0;
annotation.Height = 30;
annotation.Width = -30;
annotation.LineWidth = 3;
annotation.StartCap = LineAnchorCapStyle.None;
annotation.EndCap = LineAnchorCapStyle.None;
annotation.Alignment = ContentAlignment.BottomLeft;
annotation.AnchorAlignment = ContentAlignment.BottomRight;
annotation.AnchorDataPoint = new DataPoint(this.chart1.Series[0]);
annotation.AllowAnchorMoving = true;
annotation.AllowMoving = true;
annotation.AllowPathEditing = true;
annotation.AllowResizing = true;
annotation.AllowSelecting = true;
annotation.GraphicsPath.AddLine(10, 20, 30, 30);
chart1.Annotations.Add(annotation);
【问题讨论】:
-
您的问题解决了吗?
-
仍然。我没有得到解决该问题的方法。现在我正在寻找类似的带有注释功能的图表控件,无论是winform还是wpf。
-
我的帖子中有什么不清楚的地方吗?添加矩形对于了解您的情况非常有帮助!
-
您的解决方案对我很有帮助。但是这个 ms 图表控件不适合我的应用程序要求。感谢您回复我。
标签: c# winforms annotations mschart