我有以下图表:
正如您所看到的,它上面有不同的“气泡”。现在我想确定这个数组中每个气泡的大小:
$.ajax({
url : "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=13.089500428429146,77.48688038438559&radius=1000&type=bus_station&key=AXXXXXXXXXXXXXXXXXXXXXXX",
type:"GET",
//headers:{"Access-Control-Allow-Origin":"https://maps.googleapis.com/"},
dataType: 'jsonp',
success: function (return_data_json){
console.log(return_data_json);
}
});
每个数组值都必须确定一个不规则气泡的大小。
当我在c3js点函数中执行以下操作时:
[50656, 74775, 74134, 74318, 77090, 79558, 80879, 66409, 79394, 70568, 65741, 75617, 72875, 75642, 74860, 74572, 56873, 76395, 92584, 59884, 63883, 73079, 68963, 60745, 68672, 69265, 75852, 79526, 55839, 65724, 56244, 57881, 43969, 51164, 49105, 42654, 45248, 38664, 49189, 44962, 56116, 49088, 33534, 26759, 44963, 50152, 52880, 77049, 70816, 83561, 82987, 65752, 63452, 73085, 78574, 69719, 79643, 69024, 63256, 69749, 65890, 74162, 67179, 71524, 81191, 78711, 61509, 64361, 71754, 63657, 66497, 59616, 73892, 70820, 64589, 65686, 74687, 67879, 50645, 71913, 68082, 59279, 64530, 49948, 50541, 56983, 64402, 73220, 67787, 79476, 74849, 49940, 69804, 83774, 69927, 69523, 75300, 84355, 81397, 94328…]
我也是这样试过的:
point: {
r: function (d) {
for (var j = 0; j < getParkingDuration().length; j++) {
return getParkingDuration()[j] / 10000;
}
}
}
它只返回循环的第一个值。因此所有气泡尺寸都相同。
答案 0 :(得分:1)
你可以使用像这样的事件:
onrendered: function () {
var $$ = this;
var circles = $$.getCircles();
for (var i = 0; i < circles.length; i++) {
for (var j = 0; j < circles[i].length; j++) {
$$.getCircles(j).style("r", (Math.random()*10)^0);
}
}
}