Tee Chart Annotations

TeeChart for ActiveX, COM and ASP
Post Reply
Petar
Newbie
Newbie
Posts: 40
Joined: Tue Oct 06, 2009 12:00 am

Tee Chart Annotations

Post by Petar » Tue Dec 28, 2010 1:50 pm

Hi,

I have two graphs, one that depends on the left axis and the other on right axis and I would like to see simultaneously the coordinates of the two graphs on the respective axes on mouse move.
The problem is that I can not display the coordinates on the right axis (see attachment).

Here the code i used to add the annotations on the y-axis and x-axis :

Code: Select all

.Tools.Add(TeeChart.EToolClass.tcCursor)
.Tools.Items(.Tools.Count - 1).asTeeCursor.FollowMouse = True
.Tools.Items(.Tools.Count - 1).asTeeCursor.Style = TeeChart.ECursorToolStyle.cssVertical
.Tools.Items(.Tools.Count - 1).asTeeCursor.Pen.Visible = False

.Tools.Add(TeeChart.EToolClass.tcAnnotate) 'one annotation for each series
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Color = RGB(255, 255, 255)
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Font.Color = .Series(IntSerie).Color
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.CustomPosition = True
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Shadow.Visible = False

.Tools.Add(TeeChart.EToolClass.tcAnnotate) 'one annotation for X values.
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Color = RGB(255, 255, 255)
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.CustomPosition = True
.Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Shadow.Visible = False
Attachments
Annotation.JPG
Annotation.JPG (80.63 KiB) Viewed 4950 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Tee Chart Annotations

Post by Yeray » Wed Dec 29, 2010 2:23 pm

Hi Petar,

I've used your snipped of code in a simple application and I can't see problems in the result.
Could you please take a look at it and see if it helps you to find if there is something wrong in your application?

Code: Select all

Dim annot1, annot2 As Integer

Private Sub Form_Load()  
  With TChart1
    .Aspect.View3D = False
    .Legend.Visible = False
    
    .AddSeries scLine
    .Series(0).FillSampleValues 20
  
    .AddSeries scLine
    .Series(1).FillSampleValues 20
    .Series(1).VerticalAxis = aRightAxis
    
    .Axis.Left.GridPen.Visible = False
    .Axis.Right.GridPen.Visible = False
    .Axis.Bottom.GridPen.Visible = False
    
    annot1 = .Tools.Add(tcAnnotate)
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Color = RGB(255, 255, 255)
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Font.Color = .Series(0).Color
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.CustomPosition = True
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Shadow.Visible = False

    annot2 = .Tools.Add(tcAnnotate)
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Color = RGB(255, 255, 255)
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Font.Color = .Series(1).Color
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.CustomPosition = True
    .Tools.Items(.Tools.Count - 1).asAnnotation.Shape.Shadow.Visible = False
  End With
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  With TChart1.Tools.Items(annot1).asAnnotation
    .Text = Format$(TChart1.Axis.Left.CalcPosPoint(Y), "#0.00")
    .Left = TChart1.Axis.Left.Position - .Width
    .Top = Y - .Height / 2
  End With
  
    With TChart1.Tools.Items(annot2).asAnnotation
    .Text = Format$(TChart1.Axis.Right.CalcPosPoint(Y), "#0.00")
    .Left = TChart1.Axis.Right.Position
    .Top = Y - .Height / 2
  End With
End Sub
If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply