Page 1 of 1

TChart Canvas: Adding a line with an arrow

Posted: Tue Oct 18, 2016 9:32 pm
by 16677938
Is there a method to add a line with an arrow to the TChart Canvas? I'm adding a line with the Canvas.MoveTo() and Canvas.LineTo() calls but how do I add a line with an arrow?

Re: TChart Canvas: Adding a line with an arrow

Posted: Wed Oct 19, 2016 9:54 am
by yeray
Hello,

TeeChart includes an Arrow Series. You can add arrows with it using axis values (instead of using pixel values).
Ie:

Code: Select all

  TChart1.AddSeries scBar
  TChart1.Series(0).FillSampleValues 5
  TChart1.Series(0).ColorEachPoint = True
  
  TChart1.AddSeries scArrow
  TChart1.Series(1).ColorEachPoint = True
  TChart1.Series(1).asArrow.ArrowHeight = 10
  TChart1.Series(1).asArrow.ArrowWidth = 10
  With TChart1.Series(0)
    For i = 0 To .Count - 2
      TChart1.Series(1).asArrow.AddArrow .XValues.Value(i), .YValues.Value(i) / 2, .XValues.Value(i + 1), .YValues.Value(i + 1) / 2, "", clTeeColor
    Next i
  End With