任何人都可以向我解释如何在此处传递变量: 系列:{regions:[{values:{变量:'#B8E186',}}]},
评论部分是我到目前为止所尝试的。语法就像这样{SE:'#000FFF',}
//var myArray = [];
//myArray.push({ 'NO': '#000FFF' });
//var a = [], b = parsedData.Item1, c= '#000FFF';
//a.push('b', 'c');
//var cdata = {
map: 'world_mill',
scaleColors: ['#C8E111', '#007FFF'],
normalizeFunction: 'polynomial',
hoverOpacity: 0.7,
hoverColor: false,
markerStyle: {
initial: {
fill: '#F8E111',
stroke: '#383f47'
}
},
series: {
regions: [{
values:
{
}
}]
},
regionStyle: {
initial: {
fill: '#B8E186'
}
},
backgroundColor: '#FFFFF',
//markers: [
// { latLng: [67.16, 14.24], name: 'Norway' },
//]
//});
//};
//jQuery.each(cdata.mapData.paths, function() {
// var continentCodes = {};
// continentCodes['NO'] = "#128da7";
//cdata.series.regions[0].setValues(continentCodes);
});
//var mapObject = $('#world-map').vectorMap('camel', 'mapObject');
//mapObject.series.regions[0].setValues(parsedData.Item1) = '#000FFF';
//});
});
答案 0 :(得分:2)
假设系列将具有多个区域,并且区域的值将具有多个变量值
你需要两个for循环
var series = {};
for (i = 0; i < regions.length; i++) {
{
var regions = [];
var values = {};
for (j = 0; j < ValuesInRegion.length; j++) {
{
values[ValuesInRegion[j]['key']] = ValuesInRegion[j]['value'];
}
regions.push(values);
}
series['regions'] = regions;
最后
cdata.series = series;