#4076
配置项如下
option = {
"tooltip": {
"showContent": false
},
"title": {
"show": false
},
"animation": false,
"geo": {
"map": "world",
"roam": true,
"center": [
12,
51
],
"scaleLimit": {
"min": 5,
"max": 10
},
"itemStyle": {
"normal": {
"borderWidth": 0.9769614721921236,
"areaColor": "#ffffff",
"borderColor": "#eeeeee"
}
},
"label": {
"emphasis": {
"show": false
}
}
},
"series": [
{
"type": "bar",
"name": "Large project",
"stack": "Austria",
"xAxisIndex": 0,
"yAxisIndex": 0,
"data": [
{
"value": 1,
"itemStyle": {
"normal": {
"barBorderWidth": 1.5,
"barBorderColor": "transparent",
"color": "#EA4335"
}
}
}
]
},
{
"type": "bar",
"name": "Large project",
"stack": "Austria",
"xAxisIndex": 0,
"yAxisIndex": 0,
"data": [
{
"value": 1,
"itemStyle": {
"normal": {
"barBorderWidth": 1.5,
"barBorderColor": "transparent",
"color": "#EA4335"
}
}
}
]
},
{
"type": "bar",
"name": "Large project",
"stack": "Austria",
"xAxisIndex": 0,
"yAxisIndex": 0,
"data": [
{
"value": 1,
"itemStyle": {
"normal": {
"barBorderWidth": 1.5,
"barBorderColor": "transparent",
"color": "#EA4335"
}
}
}
]
},
{
"type": "bar",
"name": "Large project",
"stack": "Austria",
"xAxisIndex": 0,
"yAxisIndex": 0,
"data": [
{
"value": 1,
"itemStyle": {
"normal": {
"barBorderWidth": 1.5,
"barBorderColor": "transparent",
"color": "#EA4335"
}
}
}
]
},
{
"type": "bar",
"name": "Large project",
"stack": "Austria",
"xAxisIndex": 0,
"yAxisIndex": 0,
"data": [
{
"value": 1,
"itemStyle": {
"normal": {
"barBorderWidth": 1.5,
"barBorderColor": "transparent",
"color": "#EA4335"
}
}
}
]
},
{
"type": "scatter",
"name": "Funding",
"coordinateSystem": "geo",
"data": [
{
"name": "Austria",
"value": [
"14.550072",
"47.516231",
10
],
"symbol": "triangle",
"symbolSize": [
8,
8.62
],
"symbolOffset": [
10,
-4.31
],
"itemStyle": {
"normal": {
"color": "#34A853"
}
}
}
]
}
],
"grid": [
{
"left": 567.4853385290413,
"top": 269.1968956118183,
"width": 12,
"height": 50
}
],
"yAxis": [
{
"type": "value",
"axisLine": {
"show": false
},
"splitLine": {
"show": false
},
"axisLabel": {
"show": false
},
"axisTick": {
"show": false
},
"gridIndex": 0
}
],
"xAxis": [
{
"data": [
"Large project"
],
"axisLine": {
"show": false
},
"splitLine": {
"show": false
},
"axisLabel": {
"show": false
},
"axisTick": {
"show": false
},
"type": "category",
"gridIndex": 0
}
]
}
var update = function(){
var model = myChart.getModel();
var geo = model.getComponent('geo').coordinateSystem;
var latlong = ["14.550072", "47.516231"];
var xy = geo.dataToPoint(latlong);
var grid = option.grid[0];
myChart.setOption({
grid: {
left: xy[0],
top: xy[1] - grid.height
}
});
}
setTimeout(update);
// need to call off to prevent multiple bindings
myChart.off("geoRoam");
// // update xy on zoom
myChart.on("geoRoam", function(){
update();
});