0

I need some basic assistance with a Highmap (via Highcharts) I am trying to put in my Rails 4 app. I suspect I have some fundamental misunderstanding of it but can't find any clear guidance.

See a simple fiddle taken from the documentation, here

http://jsfiddle.net/SimonWalsh/zpdc1btu/

What I ultimately need to do is provide membership numbers for each country so that it will be displayed much the same as the population density is in this map.

I know I need to provide my data and the means to join it to the map data in

 series : [{
      data : data,
      mapData: Highcharts.maps['custom/world'],
      joinBy: ['iso-a2', 'code'],
      name: 'Population density',
      states: {
           hover: {
                color: '#BADA55'
           }
      }
 }]

In this example, I am guessing that the data is being pulled from an external source and that the map data is the 'iso-a2' part of the array.

If this is the case, then why can't I supply this with my data....as an example see the added array with my data.....(just one example given for Denmark)

var mydata = [
      {
           "iso-a2": "dk",
           "value": 30
       },
]

and then do

series : [{
     data : mydata,
     mapData: Highcharts.maps['custom/world'],
     joinBy: ['iso-a2', 'value'],
     name: 'Population density',
     states: {
          hover: {
          color: '#BADA55'
          }
     }
 }]

This does not work.....any guidance at all (other than simply pointing me to docs would be greatly appreciated)

1 Answer 1

1

The joinBy specifies on which value you map a country with your data. With

joinBy: ['iso-a2', 'code']

you say that the 'iso-a2' value of the mapData should be equal to the 'code' value of your data. Therefore, your data must have this format:

var mydata = [
      {
           "code": "dk",
           "value": 30
       },
       /* ... */
]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.