Skip to content
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

请问,雷达图,可否只显示一个axis的label? #3657

Closed
marine1ly opened this issue Jul 16, 2016 · 3 comments
Closed

请问,雷达图,可否只显示一个axis的label? #3657

marine1ly opened this issue Jul 16, 2016 · 3 comments

Comments

@marine1ly
Copy link

使用axisLabel之后,所有的axis上的label都显示出来了,能否只显示一个轴的label呢?
有人遇到过同样的问题吗?

option = {
tooltip: {},
radar: {
// shape: 'circle',
indicator: [
{ name: 'Sales', max: 650},
{ name: 'Admin', max: 1600},
{ name: 'Infor', max: 3000},
{ name: 'Customer Support', max: 3800},
{ name: 'Deve', max: 5200},
{ name: 'Market', max: 2500}
],
name: {
textStyle: {
fontSize: 5
}
},
splitArea: {
areaStyle: {
color: ['#ffffff', '#ffffff', '#fffffff', '#ffffff']
}
},
splitLine: {
lineStyle: {
color: 'rgba(127, 127, 127, 1)'
}
},
axisTick: {
show: false,

                        },
                        axisLabel: {
                            show: true,
                            inside: true,
                            margin: 10,
                            formatter: '{value} %',
                            textStyle: {
                                fontSize: 2,
                            }
                        },
                        nameGap: 2,
                        radius: '65%',
                        splitNumber: 4,
                    },
                    series: [{
                        name: 'Budget vs spending',
                        type: 'radar',
                        // areaStyle: {normal: {}},
                        data : [
                             {
                                value : [500, 1500, 140, 310, 4020, 210],
                                name : 'Actual Spending',
                                lineStyle: {
                                    normal: {
                                        color: '#c0504d',
                                    }
                                },
                                areaStyle: {
                                    normal: {
                                        color: '#c0504d',
                                    }
                                },
                            }
                        ]
                    }]
                };
@shine11lyj
Copy link

不知道你使用的e-charts版本是2还是3,
在2的版本中:可以设置:
tooltip : { trigger: 'axis' },
来按轴触发,默认使用的是trigger:'item'触发,会展示全部的数据;
但是使用e-charts3的这个版本时, trigger: 'axis'就没有效果了,虽然官方的api说3这个版本能更好的支持,但是实际上目前的效果确没有达到;

@marine1ly
Copy link
Author

你好,我用的是3.2.2,谢谢你。那我用2试试。
感谢

@pissang pissang closed this as completed Aug 4, 2016
@AHuskyWithRockSoul
Copy link

echarts2 可以支持,3中我是自己修改了echarts.js文件,可以算一下鼠标与原点角度,确定显示第几个
//@wangjx
//compute the anti-clockwise angle of mousePos-coordinate -- Y-line.
var getAngle = function(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;
};

    //@wangjx
    //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;
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants