Display a Country Value On Map Chart

TeeChart for ActiveX, COM and ASP
Post Reply
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Display a Country Value On Map Chart

Post by JPTP » Mon May 08, 2017 9:27 am


(Newbie here)

I have a map chart on a window. When the user hovers the mouse over a country how I can display a value associated with that country?

Thank you

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

Re: Display a Country Value On Map Chart

Post by Yeray » Mon May 08, 2017 10:50 am


You can use a MarksTip tool to show a tip when you move the mouse over the shapes/countries.
Then, you can use the OnMouseMove event to get the ValueIndex of the shape/country below the mouse and store it (ie MouseValueIndex).
And then you can use that index stores at OnMarkTipToolGetText to modify the Text string that will be shown.

Code: Select all

Dim MouseValueIndex As Integer

Private Sub Form_Load()  
  TChart1.Aspect.View3D = False
  TChart1.Legend.Visible = False
  TChart1.AddSeries scWorld
  TChart1.Series(0).asWorld.Map = wmEurope
  TChart1.Tools.Add tcMarksTip
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  MouseValueIndex = TChart1.Series(0).Clicked(X, Y)
End Sub

Private Sub TChart1_OnMarkTipToolGetText(ByVal Tool As Long, Text As String)
  If MouseValueIndex > -1 Then
    Text = TChart1.Series(0).PointLabel(MouseValueIndex) + " " + Str$(MouseValueIndex)
  End If
End Sub
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