Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Colour coding each region on Google map

Hi,

I'm trying to colour code each site differently for each region within my Qlikview map a different colour.

For example: London : red ; New York : blue ; Glasgow : Green , a different colour for common suppliers across more than one site ...etc..

Any help / tips would be appreciated!

Many thanks!


13 Replies
Not applicable
Author

Any suggestions?

Not applicable
Author

Not applicable
Author

Hi

I'm not sure to undertand. Do you want a choromap ? or do you want to color some dots ?

Look at the attachment to understand some tips.

For example, you have country & cities as dimension and you want to color each city from the same country with the same color.

Do as expression :

City

Country

Hope it helps you

JJJ

Not applicable
Author

Check out Rob Wunderlich's "QlikView Cookbook"...he has an example app that demonstrates heat maps with the Google Chart API. His is US-state based, so you'll have to do some research about converting it.

http://www.robwunderlich.com/Download.html

Not applicable
Author

Jason,

In Rob's Cookbook,there is variable called simpleEncodingMap

/* The string that will be used to perform simple encoding of the data values for Goole Chart */
SET simpleEncodingMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

What is it, how does it work. There is nothing mentioned about it but it is used in Chart in '&chd=s:' ........

Thx.

rothtd
Creator III
Creator III

This variable is needed per the Google Chart API. At a high level the Google chart API (in this example) wants you to rank/order the 50 states from highest to lowest for the metric that is being displayed in the chart. Keep in mind all these values are being passed in the URL so we want to attempt to compress it and keep the number of characters transmitted as minimal as possible. Think of this as a simple substitution method/algorithm. If the value is 0, then we substitute with the first character in the simpleEncodingMap 'A'. If the value is 1, then B; 3 then C, etc. The largest value we can account for is 61, which would be the last character '9'. The fact that we can only account for 61 values does not matter because this is a US map and we only have 50 states - hence why we are using the simpleEncodingMap and not a different method that would allow for more values. You can see that by using this method we can reduce the number of characters in the URL transmitted over the 'wire' to Google - which I am sure they appreciate.

Honestly, you don't really need to understand what's being done here, since it's only being done as a requirement of the Google Chart API - and has nothing to do with QlikView.

Documentation on the simpleEncodingMap:

http://code.google.com/apis/chart/docs/data_formats.html#simple

Documentation on the version of the Google Chart API used in the example:

http://code.google.com/apis/chart/docs/gallery/map_charts.html

Documentation on a more recent version of the Google Chart API:

http://code.google.com/apis/chart/docs/gallery/new_map_charts.html

Hope this helps!

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


pmizenin wrote:
In Rob's Cookbook,there is variable called simpleEncodingMap
/* The string that will be used to perform simple encoding of the data values for Goole Chart */
SET simpleEncodingMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
What is it, how does it work. There is nothing mentioned about it but it is used in Chart in '&chd=s:' ........


Trevor gave an excellent explanation as to why the Google Chart API requires encoding and pointed to the definitve documentation on available encodng methods. I can only add that the example "simpleEncodingMap" string is not passed in the url to Google chart. It is utilized as a parameter in the expression that builds the url with the encoed data values.

-Rob

Not applicable
Author

Hello,

I have a further question to this problem. I have 142 country codes utilised in a map that I want to display using a gradient of colours. I really only want to show the countries using a 6 colour gradient where the top 5 get coloured along the gradient and the rest get the lowest value which is an off white colour. I'm having trouble adapting the example from the cookbook.

The google documentation contradicts itself especially when I look at the code from the cookbook. Can you please answer some simple questions for me?

Is it possible to do this in theory? i.e on 6 colour codes but 142 country codes? From the documentation it makes me think I need a colour code for every country code...

This would help me a lot!

Thanks

Gareth

rothtd
Creator III
Creator III

@gcampbell

Keep in mind the Google Map API has changed since the cookbook was created (new versions have been released by Google). Back when I was working with Google Maps I used 3 colors for 50 state codes (US Map) - so I would think you could do 6 colors for 142 Country Codes without issue.

-Trevor