var data = [];
var randomCount = 9;
var geo = chart.getModel().getComponent("geo").coordinateSystem;
var region = geo.getRegion(this.jsonNames);
var rect = region.getBoundingRect();
for (var i = 0; i < randomCount; i++) {
var coord = [Infinity, Infinity];
while (!region.contain(coord)) {
coord[0] = rect.x + Math.random() * rect.width;
coord[1] = rect.y + Math.random() * rect.height;
}
data.push(coord);
}
网友评论