Highmaps - Change to mapbubble

183 views Asked by At

I have been trying to change Highmaps chart to bubble by adding
type: 'mapbubble', as below but failed Is there any way to do it ? I dont know where went wrong

series: [{
  type: 'mapbubble',
  data: data,

Appreciate if anyone can help me to do that base on the code below

Link to jsfiddle

   mapChart = Highcharts.mapChart('mapchart', {

        title: {
            text: 'Population history by country'
        },

        subtitle: {
            text: 'Source: <a href="http://data.worldbank.org/indicator/SP.POP.TOTL/countries/1W?display=default">The World Bank</a>'
        },

        mapNavigation: {
            enabled: true,
            buttonOptions: {
                verticalAlign: 'bottom'
            }
        },

        colorAxis: {
         //  type: 'logarithmic',
            endOnTick: false,
            startOnTick: false,
            min: 50000
        },

        tooltip: {
            footerFormat: '<span style="font-size: 10px">(Click for details)</span>'
        },

        series: [{
            data: data,
            mapData: mapData,
            joinBy: ['iso-a3', 'code3'],
            name: 'Current population',
            allowPointSelect: true,
            cursor: 'pointer',
            states: {
                select: {
                    color: '#a4edba',
                    borderColor: 'black',
                    dashStyle: 'shortdot'
                }
            }
        }]
    });
1

There are 1 answers

0
morganfree On BEST ANSWER
  1. Replace point.value with point.z

    data.push({
      name: countries[code3].name,
      code3: code3,
      z: value,
      year: year
    });
    
  2. Set chart.map prop to mapData:

    chart: {
      map: mapData
    },
    
  3. Create a new series which will be a background layer for bubbles.

    series: [{
      name: 'Countries',
      color: '#E0E0E0',
      enableMouseTracking: false
    },
    
  4. Set the main series type to mapbubble

    {
      data: data,
      type: 'mapbubble',
      ...
    

live example: https://jsfiddle.net/xf4tkec1/