Unable to display label on inner text and multi line text on

TeeChart for ActiveX, COM and ASP
Post Reply
WinArch
Newbie
Newbie
Posts: 2
Joined: Tue Oct 28, 2014 12:00 am

Unable to display label on inner text and multi line text on

Post by WinArch » Tue Mar 17, 2015 3:30 pm

Title - Unable to display label on inner text and multi line text on legend.

We are currently migrating from another 3rd party control to TeeChart Pro ActiveX 14. The code we are writing is C++ using Visual Studio 2013 and will be running on Windows Server 2008R2 and above and Win 7 and above.

We are unable to create a label on inner tick because we are unable to find the coordinate to display label on inner tick. How can we determine coordinates to display label on inner tick? How can we draw text on inner tick inside Chart? How can we display multiline text on legend?
Attachments
chart.png
chart.png (71.85 KiB) Viewed 8967 times

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

Re: Unable to display label on inner text and multi line text on

Post by Yeray » Wed Mar 18, 2015 10:59 am

Hello,
WinArch wrote:We are unable to create a label on inner tick because we are unable to find the coordinate to display label on inner tick. How can we determine coordinates to display label on inner tick?
You can use the bottom axis CalcXPosValue function to convert axis values to screen pixel coordinates.
WinArch wrote:How can we draw text on inner tick inside Chart?
You can use Canvas.TextOut function to draw text manually at the OnAfterDraw event.
Here you have a simple example in Visual Basic:

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  
  Dim i As Integer
  For i = 0 To 3
    TChart1.AddSeries scLine
    TChart1.Series(i).FillSampleValues
  Next i

  TChart1.Axis.Left.MinimumOffset = 50
End Sub

Private Sub TChart1_OnAfterDraw()
  Dim XPos, YPos, txtWidth, txtHeight As Integer
  Dim txt As String
  
  XPos = TChart1.Axis.Bottom.CalcXPosValue(2.5)
  YPos = TChart1.Axis.Bottom.Position
  txt = "my date"
  txtWidth = TChart1.Canvas.TextWidth(txt)
  txtHeight = TChart1.Canvas.TextHeight(txt)
  TChart1.Canvas.TextOut XPos - (txtWidth / 2), YPos - txtHeight - 2, txt
End Sub
WinArch wrote:How can we display multiline text on legend?
I'm afraid this is not supported in the current legend but you can always draw your custom legend manually as in the example here:
http://stackoverflow.com/questions/2390 ... n-teechart
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