提交 9428a1ae 编写于 作者: S sushuang

Fix hoverLinkOnHandle.

上级 f59ebc83
......@@ -29,7 +29,8 @@ define(function(require) {
itemWidth: null, // The length of the other side.
hoverLink: true, // Enable hover highlight.
hoverLinkDataSize: null,// The size of hovered data.
hoverLinkOnHandle: true // Whether trigger hoverLink when hover handle.
hoverLinkOnHandle: null // Whether trigger hoverLink when hover handle.
// If not specified, follow the value of `realtime`.
},
/**
......
......@@ -606,7 +606,6 @@ define(function(require) {
// For hover link show when hover handle, which might be
// below or upper than sizeExtent.
pos[1] = mathMin(mathMax(0, pos[1]), itemSize[1]);
self._doHoverLinkToSeries(
pos[1],
0 <= pos[0] && pos[0] <= itemSize[0]
......@@ -693,6 +692,7 @@ define(function(require) {
}
var resultBatches = modelUtil.compressBatches(oldBatch, newBatch);
this._dispatchHighDown('downplay', helper.convertDataIndex(resultBatches[0]));
this._dispatchHighDown('highlight', helper.convertDataIndex(resultBatches[1]));
},
......@@ -739,7 +739,6 @@ define(function(require) {
this._hideIndicator();
var indices = this._hoverLinkDataIndices;
this._dispatchHighDown('downplay', helper.convertDataIndex(indices));
indices.length = 0;
......@@ -837,7 +836,8 @@ define(function(require) {
}
function useHoverLinkOnHandle(visualMapModel) {
return !visualMapModel.get('realtime') && visualMapModel.get('hoverLinkOnHandle');
var hoverLinkOnHandle = visualMapModel.get('hoverLinkOnHandle');
return !!(hoverLinkOnHandle == null ? visualMapModel.get('realtime') : hoverLinkOnHandle);
}
function getCursor(orient) {
......
此差异已折叠。
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="esl.js"></script>
<script src="config.js"></script>
<script src="lib/jquery.min.js"></script>
<script src="lib/facePrint.js"></script>
<script src="lib/testHelper.js"></script>
<link rel="stylesheet" href="reset.css">
</head>
<body>
<style>
h1 {
line-height: 60px;
height: 60px;
background: #146402;
text-align: center;
font-weight: bold;
color: #eee;
font-size: 14px;
}
.chart {
height: 500px;
}
</style>
<div class="chart" id="main"></div>
<script>
var echarts;
var chart;
var myChart;
var groupCategories = [];
var groupColors = [];
require([
'echarts',
'echarts/chart/map',
'echarts/chart/custom',
'echarts/component/geo',
'echarts/component/legend',
'echarts/component/tooltip',
'echarts/component/toolbox',
'echarts/component/visualMap',
'echarts/component/dataZoom'
], function (ec) {
echarts = ec;
$.get('../map/json/world.json', function (worldJson) {
echarts.registerMap('world', worldJson);
$.getJSON('./data/global-wind.json', function (windData) {
var p = 0;
var maxMag = 0;
var minMag = Infinity;
var data = [];
for (var j = 0; j < windData.ny; j++) {
for (var i = 0; i < windData.nx; i++, p++) {
var vx = windData.data[p][0];
var vy = windData.data[p][1];
var mag = Math.sqrt(vx * vx + vy * vy);
// 数据是一个一维数组
// [ [经度, 维度,向量经度方向的值,向量维度方向的值] ]
data.push([
i / windData.nx * 360 - 180,
j / windData.ny * 180 - 90,
vx,
vy,
mag
]);
maxMag = Math.max(mag, maxMag);
minMag = Math.min(mag, minMag);
}
}
data.reverse();
var option = {
backgroundColor: '#333',
visualMap: {
left: 'center',
min: minMag,
max: maxMag,
dimension: 4,
inRange: {
// color: ['green', 'yellow', 'red']
color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
},
realtime: false,
hoverLink: true,
calculable: true,
textStyle: {
color: '#fff'
},
orient: 'horizontal'
},
geo: {
map: 'world',
left: 0,
right: 0,
top: 0,
zoom: 1,
silent: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
}
}
},
series: {
type: 'custom',
coordinateSystem: 'geo',
data: data,
// silent: true,
encode: {
x: 0,
y: 0
},
renderItem: function (params, api) {
var x = api.value(0), y = api.value(1), dx = api.value(2), dy = api.value(3);
var start = api.coord([Math.max(x - dx / 5, -180), Math.max(y - dy / 5, -90)]);
var end = api.coord([Math.min(x + dx / 5, 180), Math.min(y + dy / 5, 90)]);
return {
type: 'line',
shape: {
x1: start[0], y1: start[1],
x2: end[0], y2: end[1]
},
style: {
lineWidth: 0.5,
stroke: api.visual('color')
}
}
},
progressive: 2000
}
};
testHelper.createChart(echarts, 'main', option);
});
});
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册