TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
ipasuser
- Newbie
- Posts: 9
- Joined: Wed Nov 14, 2007 12:00 am
Post
by ipasuser » Thu Nov 15, 2007 9:07 am
Hi TeeChart Team,
we have a Chart with a ColorLine:
Code: Select all
Dim ColorLine1 as New Steema.TeeChart.Tools.ColorLine(TChart1.Chart)
ColorLine1.Active = True
ColorLine1.Axis = TChart1.Axes.Bottom
ColorLine1.Pen.Color = Color.Blue
ColorLine1.Value = TimeValue("02:30 AM").ToOADate
we want to have an annotation next to ColorLine:
Code: Select all
Dim Ann1 as New Steema.TeeChart.Tools.Annotation(TChart1.Chart)
Ann1.Active = True
Ann1.Left = ???
Ann1.Top = 50
Ann1.Text = "SomeText"
How can we achive this?
Thanks in advance.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Nov 15, 2007 12:48 pm
Hi ipasuser,
Yes, you can do something like this:
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line1.FillSampleValues()
Dim ColorLine1 As New Steema.TeeChart.Tools.ColorLine(TChart1.Chart)
ColorLine1.Active = True
ColorLine1.Axis = TChart1.Axes.Bottom
ColorLine1.Pen.Color = Color.Blue
ColorLine1.Value = TimeValue("02:30 AM").ToOADate
Dim bmp As Bitmap
bmp = TChart1.Bitmap
End Sub
Private Sub TChart1_AfterDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
For i As Integer = 0 To TChart1.Tools.Count -1
If (TypeOf TChart1.Tools(i) Is Steema.TeeChart.Tools.Annotation) Then
TChart1.Tools.RemoveAt(i)
End If
Next
Dim Ann1 As New Steema.TeeChart.Tools.Annotation(TChart1.Chart)
Ann1.Active = True
Ann1.Shape.CustomPosition = True
Dim clPos As Double
clPos = CType(TChart1.Tools(0), Steema.TeeChart.Tools.ColorLine).Value
Ann1.Shape.Left = TChart1.Axes.Bottom.CalcPosValue(clPos)
Ann1.Shape.Top = TChart1.Chart.ChartRect.Top + TChart1.Chart.ChartRect.Height / 2
Ann1.Text = "SomeText"
End Sub