我想知道是否可以在现有图表上的特定点(x,y)添加彩色三角形(向上或向下),以便在滚动/缩放图表时更新它们的位置。
我有一个谷歌,但没有偶然发现任何似乎符合这些要求的东西。
任何指针都会受到赞赏。
答案 0 :(得分:2)
如MS Chart Samples中所述,您可以使用注释
private void AddLineAnnotation()
{
LineAnnotation annotation = new LineAnnotation();
annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
annotation.Height = -25;
annotation.Width = -25;
annotation.LineWidth = 2;
annotation.StartCap = LineAnchorCapStyle.Arrow;
annotation.EndCap = LineAnchorCapStyle.Arrow;
Chart1.Annotations.Add(annotation);
}
您甚至可以将自定义多边形定义为注释
private void AddPolygonAnnotation()
{
PolygonAnnotation annotation = new PolygonAnnotation();
annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
// explicitly set the relative height and width
annotation.Height = 50;
annotation.Width = 30;
annotation.BackColor = Color.FromArgb(128, Color.Orange);
annotation.LineColor = Color.Black;
annotation.LineDashStyle = ChartDashStyle.Solid;
// define relative value points for a polygon
PointF [] points = new PointF[5];
points[0].X = 0;
points[0].Y = 0;
points[1].X = 100;
points[1].Y = 0;
points[2].X = 100;
points[2].Y = 100;
points[3].X = 0;
points[3].Y = 100;
points[4].X = 50;
points[4].Y = 50;
annotation.Path.AddPolygon(points);
Chart1.Annotations.Add(annotation);
}
答案 1 :(得分:2)
绘制带标记的点图。 创建自己的图像并使用MarkerImage属性加载自定义图像
答案解释如何获得倒三角形 Custom MarkerStyles possible in Microsoft Chart Controls?