Map Chart

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

Map Chart

Post by JPTP » Fri May 05, 2017 6:48 pm

Hi

TeeChart Newbie here :)

I have a Map Chart on a window. I can hover over countries and they outline. I can click on a country and receive the OnClickSeries event. How do I change the colour of the country I clicked on?

Using TeeChart 2016

TIA

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

Re: Map Chart

Post by Yeray » Mon May 08, 2017 7:52 am

Hello,

Here it is a simple example:

Code: Select all

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

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If SeriesIndex > -1 And ValueIndex > -1 Then
    If TChart1.Series(SeriesIndex).PointColor(ValueIndex) = vbRed Then
      TChart1.Series(SeriesIndex).PointColor(ValueIndex) = clTeeColor
    Else
      TChart1.Series(SeriesIndex).PointColor(ValueIndex) = vbRed
    End If
  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

JPTP
Newbie
Newbie
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Re: Map Chart

Post by JPTP » Mon May 08, 2017 8:17 am

Hi Yeray

Thanks for this. I have got your suggestion working. One problem I have with Steema Help Documentation is finding out what the properties and methods are for the various things. For example, you wrote in our reply:

TChart1.Series(SeriesIndex).PointColor(ValueIndex) = vbRed

Where can I find out these properties like PointColor etc.? I have been looking through the help files but cant seem to find this ... ?

Thank you.

JP

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

Re: Map Chart

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

Hello,

It's difficult to have an example of every property. However, we use to recommend looking at the Fetures Demo program shipped with the installation to see the majority of features in action.
There's also the documentation, with a list of all the properties and methods. Ie, you can find the PointColor property in the online documentation, going to the TeeChart Pro ActiveX Library Reference -> TeeChartx -> Series -> Properties -> Point Color.
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

JPTP
Newbie
Newbie
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Re: Map Chart

Post by JPTP » Mon May 08, 2017 11:41 am

Hi Yeray

Thanks again. So how would I set the tooltip for a data point (i.e. a country) using a similar way as to PointColor()?

e.g. AX_TeeChartX.Series(ISeries).PointColor(ValueIndex) = RGB(255,123,32)

For example? Is it possible something similar for tooltip?

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

Re: Map Chart

Post by Yeray » Mon May 08, 2017 11:54 am

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

JPTP
Newbie
Newbie
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Re: Map Chart

Post by JPTP » Mon May 08, 2017 12:08 pm

I'm sorry Yeray, but I dont see in the example how I set the text for any specific point (i.e. country) in the chart ? Sorry for being a newb ...

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

Re: Map Chart

Post by Yeray » Mon May 08, 2017 1:28 pm

Hello,

The OnMarkTipToolGetText is fired every time the MarkTip tool is going to be drawn. When it is fired, you have the ValueIndex of the point (MouseValueIndex), and the Text before being modified.
That should be enough information to modify the Text as you want.

Code: Select all

Private Sub TChart1_OnMarkTipToolGetText(ByVal Tool As Long, Text As String)
  If MouseValueIndex > -1 Then
    Text = "Put the text you want for the ValueIndex: " + Str$(MouseValueIndex) + " here"
  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

JPTP
Newbie
Newbie
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Re: Map Chart

Post by JPTP » Mon May 08, 2017 2:37 pm

Yeray

Thanks. So to add a MarkTip Tool to the chart I need to us something like: TChart1.Tools.Add tcMarksTip

What is the value of the constant tcMarksTip ? Where do I find these in the help?

Thanks

JPTP
Newbie
Newbie
Posts: 7
Joined: Thu May 05, 2016 12:00 am

Re: Map Chart

Post by JPTP » Mon May 08, 2017 2:55 pm

Yeray

Almost have it :)

I have added a MarkTip tool to the chart
I have the call to OnMarkTipToolGetText() working and can set the tooltip text.

However, I do not know how to convert the OnMouseMouse() x and y values into a country ValueIndex ? I can receive the OnMouseMouse() function but it only gives me x and y parameters, not a ValueIndex. How to find the ValueIndex from the x and y values?

Thanks!

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

Re: Map Chart

Post by Yeray » Tue May 09, 2017 6:33 am

Hello,
JPTP wrote:What is the value of the constant tcMarksTip ? Where do I find these in the help?
You can find the value for each constant at the TeeChartDefines.h, at the "Utilities\New VC Classes" folder in the TeeChart installation path.
JPTP wrote:However, I do not know how to convert the OnMouseMouse() x and y values into a country ValueIndex ? I can receive the OnMouseMouse() function but it only gives me x and y parameters, not a ValueIndex. How to find the ValueIndex from the x and y values?
In the example here I used the series Clicked function to return the ValueIndex of the point at the given X, Y coordinates:

Code: Select all

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
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

JPTP
Newbie
Newbie
Posts: 7
Joined: Tue May 09, 2017 12:00 am

Re: Map Chart

Post by JPTP » Tue May 09, 2017 6:12 pm

Hi Yeray

Thanks I did not notice there was more code in the code window you provided - didn't see the scroll bar. I have it all working for now. Thanks very much.

Is there any place where one can see an exhaustive list of available functions that one can call?

Thanks!

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

Re: Map Chart

Post by Yeray » Wed May 10, 2017 8:53 am

Hello,
JPTP wrote: Is there any place where one can see an exhaustive list of available functions that one can call?
The options are:
- Online documentation including Tutorials and Library Reference. Documentation is also shipped with the installation for offline access.
- Compiled examples (with sources) shipped with the installation.
- IntellSense built-in the IDE of your choice to list properties or methods available for an object.
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

JPTP
Newbie
Newbie
Posts: 7
Joined: Tue May 09, 2017 12:00 am

Re: Map Chart

Post by JPTP » Wed May 10, 2017 9:29 am

Thanks Yeray. I have been looking through those CHM help files but find them hard to find things I am looking for. Your help is awesome though. Thanks.

Any suggestion regarding changing the colour of the country outline highlight colour when mouse over a country? Currently it is orange on my system but I prefer to change the colour if possible (and outline line thickness).

Thanks

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

Re: Map Chart

Post by Yeray » Wed May 10, 2017 1:52 pm

JPTP wrote:Any suggestion regarding changing the colour of the country outline highlight colour when mouse over a country? Currently it is orange on my system but I prefer to change the colour if possible (and outline line thickness).
I'll reply you 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