gpt4 book ai didi

javascript - Highmaps - 更改为 mapbubble

转载 作者:行者123 更新时间:2023-12-03 01:50:45 35 4
gpt4 key购买 nike

我一直在尝试通过添加将 Highmaps 图表更改为气泡
输入:'mapbubble',如下但失败有什么办法可以做到吗?不知道哪里出了问题

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

如果有人可以帮助我根据下面的代码做到这一点,我将不胜感激

链接到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. point.value替换为point.z

    data.push({
    name: countries[code3].name,
    code3: code3,
    z: value,
    year: year
    });
  2. chart.map 属性设置为 mapData:

    chart: {
    map: mapData
    },
  3. 创建一个新系列,作为气泡的背景层。

    series: [{
    name: 'Countries',
    color: '#E0E0E0',
    enableMouseTracking: false
    },
  4. 将主系列类型设置为mapbubble

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

实例:https://jsfiddle.net/xf4tkec1/

关于javascript - Highmaps - 更改为 mapbubble,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50423870/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com