0
調整MS圖表。我已經成功繪製了一張動態圖表,但需要在圖表上繪製一條線(黃色)。我將如何繪製(黃色)線。我有X和Y值。 如何使用MSChart對角線繪製帶狀線?
調整MS圖表。我已經成功繪製了一張動態圖表,但需要在圖表上繪製一條線(黃色)。我將如何繪製(黃色)線。我有X和Y值。 如何使用MSChart對角線繪製帶狀線?
這裏是你可以玩一個例子:
// we create a general LineAnnotation, ie not Vertical or Horizontal:
LineAnnotation lan = new LineAnnotation();
// we use Axis scaling, not chart scaling
lan.IsSizeAlwaysRelative = false;
lan.LineColor = Color.Yellow;
lan.LineWidth = 5;
// the coordinates of the starting point in axis measurement
lan.X = 3.5d;
lan.Y = 0d;
// the size:
lan.Width = -3.5d;
lan.Height = 5.5d;
// looks like we need an anchor point, no matter which..
lan.AnchorDataPoint = yourSeries.Points[0];
// now we can add the LineAnnotation;
chart1.Annotations.Add(lan);
貌似'LineAnnotation' .. – TaW 2014-12-05 15:36:36