-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Echarts3雷达图tooltip只需显示当前点的value值 #3354
Comments
@John8848 我也有同样的需求 |
正好我今天也有这个需求,基于echarts3.6.2整合其他牛人的代码之后的文件。 |
事隔半年才发过来!正用的时候没有回复?
在 2017-07-07 11:57:57,"d-coder" <notifications@github.com> 写道:
今天我刚修改了一份3.6.2的,基于之前别的代码。
var defaultHtml = dataModel.formatTooltip(dataIndex, e, false, dataType);
`formatTooltip: function (dataIndex,e) {
//compute the anti-clockwise angle of mousePos-coordinate -- Y-line.
var getAngle = function(mx,my,px,py){
console.log(mx+","+my+","+px+","+py);
var x = Math.abs(px-mx);
var y = Math.abs(py-my);
var z = Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
var cos = y/z;
var radina = Math.acos(cos);
var angle = Math.floor(180/(Math.PI/radina));
if(mx>px && my>py){
angle = 180-angle;
}
if(mx==px && my>py){
angle = 180;
}
if(mx>px && my==py){
angle = 90;
}
if(mx<px && my>py){
angle = 180+angle;
}
if(mx<px && my==py){
angle = 270;
}
if(mx<px && my<py){
angle = 360-angle;
}
//the Echarts radar turns anti-clockwise.
return 360-angle;
};
//get index by angle;
var getIndexToDisplay = function(num,angle){
var filterIndex =0;
for(var i=0; i<num; i++){
if(angle>(360/num*i-360/num/2) && angle<(360/num*i+360/num/2)){
filterIndex = i;
break;
}
}
return filterIndex;
};
var value = this.getRawValue(dataIndex);
var coordSys = this.coordinateSystem;
//get index by position of mouse.
var index = getIndexToDisplay(value.length,getAngle(e.offsetX,e.offsetY,coordSys.cx,coordSys.cy));
var indicatorAxes=coordSys.getIndicatorAxes();
var tipHtml=indicatorAxes[index].name;
var len=this.getData().count();
for(var i=0;i<len;i++){
tipHtml+='<br/>'+this.getData().getName(i)+' : '+this.getRawValue(i)[index]
}
return tipHtml;
//region code, display all data of this series.
/*return (this._data.getName(dataIndex) == '' ? this.name : this._data.getName(dataIndex)) + '<br/>'
+ zrUtil.map(indicatorAxes, function (axis, idx) {
return axis.name + ' : ' + value[idx];
}).join('<br />');*/
},`
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
mark下 |
@dantelife 用了你上面那个 发现雷达图周围一圈文字没有了 |
@mmmaomao21 不应该,好好看下你option。具体什么情况?贴图看看。 |
我想问下用NPM包的话怎么用回你的js |
我发现可以用了 请问一下用这个js包的话 可以拿到回调的params吗 而不是直接显示出来 |
This issue is closed due to not being active. Please feel free to open it again (for the author) or create a new one and reference this (for others) if you have further questions. |
问题简述 (One-line summary)
Echarts3雷达图鼠标经过某点时,tooltip只需显示当前点的value值,不需要显示所有value值
版本及环境 (Version & Environment)
重现步骤 (Steps to reproduce)
期望结果 (Expected behaviour)
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
其他信息 (Other comments)
The text was updated successfully, but these errors were encountered: