echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Echarts3雷达图tooltip只需显示当前点的value值

Open John8848 opened this issue 10 years ago • 9 comments

问题简述 (One-line summary)

Echarts3雷达图鼠标经过某点时,tooltip只需显示当前点的value值,不需要显示所有value值

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.1.10
  • 浏览器类型和版本 (Browser version):chrome
  • 操作系统类型和版本 (OS Version):windows10

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {

}

其他信息 (Other comments)

John8848 avatar Jun 04 '16 05:06 John8848

@John8848 我也有同样的需求

aufula avatar Jun 06 '16 02:06 aufula

正好我今天也有这个需求,基于echarts3.6.2整合其他牛人的代码之后的文件。 echarts-3.6.2-radar.zip

dantelife avatar Jul 07 '17 04:07 dantelife

事隔半年才发过来!正用的时候没有回复?

在 2017-07-07 11:57:57,"d-coder" [email protected] 写道:

今天我刚修改了一份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.

John8848 avatar Jul 07 '17 08:07 John8848

mark下

songkai2012 avatar Dec 12 '17 01:12 songkai2012

@dantelife 用了你上面那个 发现雷达图周围一圈文字没有了 就是设置indicator的那个

mmmaomao21 avatar Apr 27 '18 08:04 mmmaomao21

@mmmaomao21 不应该,好好看下你option。具体什么情况?贴图看看。

dantelife avatar Apr 27 '18 08:04 dantelife

@mmmaomao21 不应该,好好看下你option。具体什么情况?贴图看看。

我想问下用NPM包的话怎么用回你的js

NicholasZhan avatar May 14 '19 04:05 NicholasZhan

@mmmaomao21 不应该,好好看下你option。具体什么情况?贴图看看。

我发现可以用了 请问一下用这个js包的话 可以拿到回调的params吗 而不是直接显示出来

NicholasZhan avatar May 14 '19 06:05 NicholasZhan

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.

echarts-bot avatar Jun 28 '19 08:06 echarts-bot