提交 6f9fd7a6 编写于 作者: K kener

tooltip bug fixed

上级 1153a9c7
...@@ -215,6 +215,7 @@ define(function (require) { ...@@ -215,6 +215,7 @@ define(function (require) {
__hide: function () { __hide: function () {
this._lastDataIndex = -1; this._lastDataIndex = -1;
this._lastSeriesIndex = -1; this._lastSeriesIndex = -1;
this._lastItemTriggerId = -1;
if (this._tDom) { if (this._tDom) {
this._tDom.style.display = 'none'; this._tDom.style.display = 'none';
} }
...@@ -925,17 +926,15 @@ define(function (require) { ...@@ -925,17 +926,15 @@ define(function (require) {
specialCssText += this._style(this.query(data, 'tooltip')); specialCssText += this._style(this.query(data, 'tooltip'));
} }
else { else {
this._lastDataIndex = NaN; this._lastItemTriggerId = NaN;
this._lastSeriesIndex = NaN;
showContent = this.deepQuery([data, serie, this.option], 'tooltip.showContent'); showContent = this.deepQuery([data, serie, this.option], 'tooltip.showContent');
formatter = this.deepQuery([data, serie, this.option], 'tooltip.islandFormatter'); formatter = this.deepQuery([data, serie, this.option], 'tooltip.islandFormatter');
position = this.deepQuery([data, serie, this.option], 'tooltip.islandPosition'); position = this.deepQuery([data, serie, this.option], 'tooltip.islandPosition');
} }
// 相同dataIndex seriesIndex时不再触发内容更新 // 相同dataIndex seriesIndex时不再触发内容更新
if (this._lastDataIndex != dataIndex || this._lastSeriesIndex != seriesIndex) { if (this._lastItemTriggerId !== this._curTarget.id) {
this._lastDataIndex = dataIndex; this._lastItemTriggerId = this._curTarget.id;
this._lastSeriesIndex = seriesIndex;
if (typeof formatter === 'function') { if (typeof formatter === 'function') {
this._curTicket = (serie.name || '') + ':' + dataIndex; this._curTicket = (serie.name || '') + ':' + dataIndex;
this._tDom.innerHTML = formatter.call( this._tDom.innerHTML = formatter.call(
...@@ -1010,8 +1009,7 @@ define(function (require) { ...@@ -1010,8 +1009,7 @@ define(function (require) {
this._tDom.innerHTML = '' this._tDom.innerHTML = ''
+ (serie.name != null ? (this._encodeHTML(serie.name) + '<br/>') : '') + (serie.name != null ? (this._encodeHTML(serie.name) + '<br/>') : '')
+ (name === '' ? '' : (this._encodeHTML(name) + ' : ')) + (name === '' ? '' : (this._encodeHTML(name) + ' : '))
+ (value instanceof Array ? value : this.numAddCommas(value)) + (value instanceof Array ? value : this.numAddCommas(value));
+ (special == null ? '' : (' (' + special + ')'));
} }
} }
} }
...@@ -1118,10 +1116,7 @@ define(function (require) { ...@@ -1118,10 +1116,7 @@ define(function (require) {
style[pType].type = axisPointer[pType + 'Style'].type; style[pType].type = axisPointer[pType + 'Style'].type;
} }
for (var i = 0, l = seriesArray.length; i < l; i++) { for (var i = 0, l = seriesArray.length; i < l; i++) {
if (this.deepQuery( if (this.deepQuery([seriesArray[i], this.option], 'tooltip.trigger') === 'axis') {
[seriesArray[i], this.option], 'tooltip.trigger'
) === 'axis'
) {
queryTarget = seriesArray[i]; queryTarget = seriesArray[i];
curType = this.query(queryTarget, 'tooltip.axisPointer.type'); curType = this.query(queryTarget, 'tooltip.axisPointer.type');
pointType = curType || pointType; pointType = curType || pointType;
...@@ -1242,7 +1237,7 @@ define(function (require) { ...@@ -1242,7 +1237,7 @@ define(function (require) {
__onmousemove: function (param) { __onmousemove: function (param) {
clearTimeout(this._hidingTicket); clearTimeout(this._hidingTicket);
clearTimeout(this._showingTicket); clearTimeout(this._showingTicket);
if (this._mousein && this.enterable) { if (this._mousein && this._enterable) {
return; return;
} }
var target = param.target; var target = param.target;
...@@ -1644,6 +1639,7 @@ define(function (require) { ...@@ -1644,6 +1639,7 @@ define(function (require) {
this._lastDataIndex = -1; this._lastDataIndex = -1;
this._lastSeriesIndex = -1; this._lastSeriesIndex = -1;
this._lastItemTriggerId = -1;
if (newOption) { if (newOption) {
this.option = newOption; this.option = newOption;
...@@ -1672,6 +1668,7 @@ define(function (require) { ...@@ -1672,6 +1668,7 @@ define(function (require) {
this._setSelectedMap(); this._setSelectedMap();
this._axisLineWidth = this.option.tooltip.axisPointer.lineStyle.width; this._axisLineWidth = this.option.tooltip.axisPointer.lineStyle.width;
this._enterable = this.option.tooltip.enterable;
} }
if (this.showing) { if (this.showing) {
var self = this; var self = this;
......
...@@ -244,7 +244,7 @@ define(function() { ...@@ -244,7 +244,7 @@ define(function() {
showDelay: 20, // 显示延迟,添加显示延迟可以避免频繁切换,单位ms showDelay: 20, // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
hideDelay: 100, // 隐藏延迟,单位ms hideDelay: 100, // 隐藏延迟,单位ms
transitionDuration: 0.4, // 动画变换时间,单位s transitionDuration: 0.4, // 动画变换时间,单位s
enterable: true, enterable: false,
backgroundColor: 'rgba(0,0,0,0.7)', // 提示背景颜色,默认为透明度为0.7的黑色 backgroundColor: 'rgba(0,0,0,0.7)', // 提示背景颜色,默认为透明度为0.7的黑色
borderColor: '#333', // 提示边框颜色 borderColor: '#333', // 提示边框颜色
borderRadius: 4, // 提示边框圆角,单位px,默认为4 borderRadius: 4, // 提示边框圆角,单位px,默认为4
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册