简体   繁体   中英

Highmaps - Change to mapbubble

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM